Database Star

Here’s a quick SQL puzzle for you.

SELECT department_id, COUNT(*) AS total
FROM employee
GROUP BY department_id
HAVING COUNT(*) > 5;

What do you think this returns?

2 months ago (edited) | [YT] | 39



@ejunkiex9041

Guys the '...' in the last row means that additional records are implied. So it's all departments having more than 5 employees and their respective count of employees, two fields: department_id and count

2 months ago | 6

@stevewaters7559

The list of dept IDs with 6 or more employees

2 months ago | 2

@__-qt3mo

The table name is [employee] but the query selects from [employees] so it returns an error

2 months ago | 7

@aiasaiascon3894

As far as I understand, the query says - Based on the department_id COUNT how many times each department_id shows up in the table and give me the department_id that has COUNT > 5 (which means the department_id that shows up more than 5 times) I think the result is an empty result statement....

2 months ago | 3

@nove1398

Based on sample data not enough records have been grouped to display anything

2 months ago | 4

@chrisdaykin3899

An empty result

2 months ago | 1

@phani5247

No result

2 months ago | 0