Multiple choice technology databases

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 DEPARTMENT_ID = NULL; What is true about this SQL statement?

  1. The SQL statement displays the desired results

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

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

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

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The SQL statement uses DEPARTMENT_ID = NULL, which is incorrect because NULL requires the IS NULL or IS NOT NULL operators. The equality operator (=) always returns NULL (not TRUE or FALSE) when comparing with NULL, so no rows are selected. The correct syntax is WHERE DEPARTMENT_ID IS NULL. Options A, C, and D are incorrect - the operator itself needs to change, not the column name, and outer joins are not needed here.