VR Startup Company #5

I’m trying to figure out why the employee_id column is not descending from largest to smallest.

SELECT *
FROM projects
INNER JOIN employees   
ON projects.project_id = employees.current_project
WHERE current_project IS NOT NULL
GROUP BY project_name
ORDER BY COUNT(employee_id) DESC
LIMIT 7;

The questions asks, 'What is the name of the project chosen by the most employees?"

Rather than SELECT * wouldn’t you want to just select project_name from projects? And then your JOIN looks correct as does almost everything else.
Double check your LIMIT clause…and go back to what the question is asking,

that would be the answer to their question. I’m asking why doesn’t the DESC for the employee_id column appear in a decreasing order.

Hello @cchu9786 ,

Welcome to the forums!

The query is ordering by COUNT(employee_id), current_project column not the employee_id column in descending order. In other wards, it’s the number of people on the project.

I hope that makes sense.

1 Like