VR Startup Companies Exercise Q5

Hi all,

I am working on the VR Startup questions in the Extra Practice section of the SQL course: Codecademy

I just wrote some code for question 5 which gives the same answer as the solution code, but I am wondering why the solution code includes “WHERE current_project IS NOT NULL”. Wouldn’t doing an inner join eliminate this issue anyway-- if current_project is NULL then it won’t match a project_id and therefore won’t be included in the table? What am I missing??

My code:

SELECT projects.project_name, 
  COUNT(*) AS '#_times_chosen'
FROM employees
JOIN projects
  ON employees.current_project = projects.project_id
GROUP BY 1
ORDER BY 2 DESC
LIMIT 1;

Solution code:

SELECT project_name
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 1;

Thanks! Megan