Which of the following is a legal expression in SQL ?
a . SELECT NULL FROM EMPLOYEE ;
b SELECT NAME FROM EMPLOYEE ;
C. SELECT NAME FROM EMPLOYEE WHERE SALARY = NULL ;
d SELECT WHERE SALARY IS NULL FROM EMPLOYEE
Answers
Answer:
The correct answer to the question “Which of the following is a legal expression in SQL” is option (b). SELECT NAME FROM EMPLOYEE.
Hope it helps.
Please follow.
Please thanks.
Answer:
Option(b) and option(c) are legal expressions in SQL:
b SELECT NAME FROM EMPLOYEE ;
C. SELECT NAME FROM EMPLOYEE WHERE SALARY = NULL ;
Explanation:
The SELECT command is used to select the subset of data from the table. You need to specify the fields of the data that you want to be displayed.
a . SELECT NULL FROM EMPLOYEE ;
In this query, you are specifying NULL to select that is not possible. It means this is not a valid SQL query.
b SELECT NAME FROM EMPLOYEE ;
Here, we are specifying NAME filed from the EMPLOYEE table. So it is a legal expression in SQL.
C. SELECT NAME FROM EMPLOYEE WHERE SALARY = NULL ;
Here those employees' names will be displayed whose SALARY is NULL so it is also a legal expression in SQL.
d SELECT WHERE SALARY IS NULL FROM EMPLOYEE
In this query syntax of the SQL is violated. So it is also not a valid SQL query.
Hence, only option(b) and option(c) are valid and legal expressions in SQL.
#SPJ3