EasyBasic SELECT
Count distinct departments in employees table
The query
SQL
SELECT COUNT(DISTINCT dept_id) AS unique_departments
FROM employees;Note
“COUNT(DISTINCT col) counts unique non-null values. Different from COUNT(*) which counts all rows.
SELECT COUNT(DISTINCT dept_id) AS unique_departments
FROM employees;Note
“COUNT(DISTINCT col) counts unique non-null values. Different from COUNT(*) which counts all rows.