⚡️ Pass with Confidence Sale - 40% off ALL packages! ⚡️

2 days, 0 hour remaining!

CompTIA Data+ DA0-002 (V2) Practice Question

You are reviewing a colleague's query that should list all departments and the number of employees hired on or after 2022-01-01. Departments with no qualifying hires must still appear with a count of 0.

SELECT d.department_name,
       COUNT(e.employee_id) AS hires_since_2022
FROM   departments d
LEFT JOIN employees e
       ON d.department_id = e.department_id
WHERE  e.hire_date >= '2022-01-01'
GROUP BY d.department_name;

When the query runs, departments without recent hires are missing. Which single change will correct the query so that those departments are kept and the count still reflects only post-2022 hires?

  • Add the keyword DISTINCT to the SELECT list.

  • Include e.hire_date in the GROUP BY clause.

  • Move the e.hire_date >= '2022-01-01' condition from the WHERE clause to the ON clause of the LEFT JOIN.

  • Replace the LEFT JOIN with an INNER JOIN and leave the WHERE clause as is.

CompTIA Data+ DA0-002 (V2)
Data Analysis
Your Score:
Settings & Objectives
Random Mixed
Questions are selected randomly from all chosen topics, with a preference for those you haven’t seen before. You may see several questions from the same objective or domain in a row.
Rotate by Objective
Questions cycle through each objective or domain in turn, helping you avoid long streaks of questions from the same area. You may see some repeat questions, but the distribution will be more balanced across topics.

Check or uncheck an objective to set which questions you will receive.

Bash, the Crucial Exams Chat Bot
AI Bot