What is the output? DECLARE @val CHAR(20) SET @val = ' SQL is cool ' select LEN(@val)

  1. 20

  2. 14

  3. 12

  4. 13


Correct Option: C

AI Explanation

To answer this question, you need to understand the LEN function in SQL.

The LEN function is used to return the number of characters in a specified string. In this case, the specified string is the variable @val, which is set to ' SQL is cool '.

The LEN function will count all characters in the string, including leading and trailing spaces. Therefore, the output of the query select LEN(@val) will be the total number of characters in the string, which is 12.

So, the correct answer is C) 12.

Find more quizzes: