MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The SQL statement “SELECT CHAR ____ LENGTH(’John’);” will return,
A
1
B
2
C
3
D
4
Explanation: 

Detailed explanation-1: -Well, you can use the LEN() function to find the length of a String value in SQL Server, for example, LEN(emp name) will give you the length of values stored in the column emp name.

Detailed explanation-2: -The CHAR and VARCHAR types are declared with a length that indicates the maximum number of characters you want to store. For example, CHAR(30) can hold up to 30 characters. The length of a CHAR column is fixed to the length that you declare when you create the table. The length can be any value from 0 to 255.

Detailed explanation-3: -The LENGTH() function returns the length of a string (in bytes).

Detailed explanation-4: -The LEFT() function extracts a number of characters from a string (starting from left).

There is 1 question to complete.