Question:medium

What will be the result of the following SQL command?

SELECT LENGTH('Data Base');

(Note: There is single space between the words Data and Base.)

Show Hint

LENGTH() counts every character, and a space is also a character. Count the letters and the space.
Updated On: Oct 20, 2026
  • 7
  • 8
  • 9
  • Error
Show Solution

The Correct Option is C

Solution and Explanation

Step 1: Look at the string by position:
Write out each position of 'Data Base':
1 = D, 2 = a, 3 = t, 4 = a, 5 = space, 6 = B, 7 = a, 8 = s, 9 = e.
The last position is 9.

Step 2: Apply the rule:
LENGTH() gives the count of all characters in the string.
The space is a character, so it is counted.
The count is 9.

Step 3: Eliminate wrong choices:
If the space were left out, the count would be 8, which is option 2. That is wrong because the space counts.
7 does not match any way of counting the string, so option 1 is wrong.
Option 4 (Error) is wrong because SELECT with a function and no table is valid in MySQL.

Final Answer:
The command prints 9, which is option 3.
Was this answer helpful?
0

Top Questions on Text Date and Math Functions in MySQL