Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (45k points)
closed by

A) SELECT NULL FROM EMPLOYEE

B) SELECT NAME FROM EMPLOYEE

C) SELECT NAME FROM EMPLOYEE WHEN SALARY = NULL

D) None of the above

closed

4 Answers

0 votes
by (99k points)
selected by
 
Best answer

The correct answer to the question “Which of the following is a legal expression in SQL” is option (b). SELECT NAME FROM EMPLOYEE. And all the other option is incorrect. If you wish to learn more about SQL and wish to get certified, then check out the SQL certification course from Intellipaat. Also, watch the following video on SQL Tutorial.

0 votes
by (13k points)

B) SELECT NAME FROM EMPLOYEE.

0 votes
by (7.8k points)
The legal expression in SQL is option B) SELECT NAME FROM EMPLOYEE. Option A is invalid because NULL cannot be used as a column name. Option C is incorrect due to the incorrect usage of the equals (=) operator with NULL. Therefore, option B is the correct choice, as it retrieves the NAME column from the EMPLOYEE table.
0 votes
by (7.8k points)
The legal expression in SQL among the options provided is option B) SELECT NAME FROM EMPLOYEE.

Option A) SELECT NULL FROM EMPLOYEE is not a valid expression because NULL is a keyword representing the absence of a value and cannot be used as a column name.

Option C) SELECT NAME FROM EMPLOYEE WHEN SALARY = NULL is also not a valid expression. To compare with NULL, you should use the IS NULL or IS NOT NULL operators instead of the equals (=) operator.

Therefore, option B) SELECT NAME FROM EMPLOYEE is the correct choice as it follows the proper syntax and retrieves the NAME column from the EMPLOYEE table.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
2 answers
0 votes
4 answers
asked Mar 23, 2021 in SQL by dev_sk2311 (45k points)

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...