SQL Functions & CASE · Question 5 · Easy

The string literal below has two spaces before Pune and two spaces after it. What does the query return?

SELECT LENGTH(TRIM('  Pune  '));
  1. 8
  2. 6
  3. 4
  4. 5
Answer and explanation

Answer: C. 4

Explanation: TRIM removes the leading and trailing spaces, leaving Pune, and LENGTH of Pune is 4. Without TRIM the length would be 8.

Previous: Table Student: roll | name | marks 1 | Aarav | 82 2 | Diya | 67 3 | Kabir | 45… · Next: Which standard SQL function converts a value from one data type to another…

Practise sql functions & case

Try a fresh set of sql functions & case questions with an explanation after every answer, free and without signing up: SQL Functions & CASE practice. Or sit a full placement mock test.

More sql functions & case questions

More sql practice

UNION, INTERSECT & EXCEPT · Tables, Keys & Constraints · DML & Transactions · SELECT, WHERE & ORDER BY · SQL Joins · Aggregates & GROUP BY · Subqueries & CTEs · Window Functions

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge