Question:

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
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Step 1: Recall the function:
The LENGTH() function in MySQL returns the number of characters in a string.
It counts every character, including spaces.

Step 2: Count the characters one by one:
The string is 'Data Base'.
The word Data has 4 letters: D, a, t, a.
Then there is 1 space, as the note says.
The word Base has 4 letters: B, a, s, e.
Total = 4 + 1 + 4 = 9.

Step 3: Write the output:
SELECT LENGTH('Data Base'); gives a single value, 9.

Step 4: Why the other options are wrong:
Option 1 (7) is wrong because it skips both the space and a letter.
Option 2 (8) is wrong because it ignores the space.
Option 4 (Error) is wrong because the command has the correct syntax, and SELECT can be used without a table in MySQL.

Final Answer:
The result is 9. This is option 3.
Was this answer helpful?
0
0

Top CBSE CLASS XII Text Date and Math Functions in MySQL Questions

View More Questions