The EMP table contains these columns: LAST NAME VARCHAR2(25) SALARY NUMBER(6,2) DEPARTMENT_ID NUMBER(6) You need to display the employees who have not been assigned to any department. You write the SELECT statement: SELECT LAST_NAME, SALARY, DEPARTMENT_ID FROM EMP WHERE DEPARMENT_ID = NULL; What is true about this SQL statement?

  1. The SQL statement displays the desired results

  2. The column in the WHERE clause should be changed to display the desired results

  3. The operator in the WHERE clause should be changed to display the desired results

  4. The WHERE clause should be changed to use an outer join to display the desired results


Correct Option: C

AI Explanation

To answer this question, let's analyze the given SQL statement:

SELECT LAST_NAME, SALARY, DEPARTMENT_ID
FROM EMP
WHERE DEPARMENT_ID = NULL;

The SQL statement is attempting to display the employees who have not been assigned to any department. However, the statement contains an error in the WHERE clause.

The correct operator to compare a column to a NULL value is the "IS NULL" operator, not the "=" operator.

Therefore, the correct answer is:

C. The operator in the WHERE clause should be changed to display the desired results

Find more quizzes: