What is the output of this SQL query? SELECT COUNT(DISTINCT department_id) FROM employees;
16 views
- Total number of employees
- Total number of unique departments (Correct Answer)
- Total number of NULL values in department_id
- Total rows including duplicates
Explanation
COUNT(DISTINCT) counts only unique non-NULL values in department_id, giving the number of unique departments.