Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL Aggregation for HR Headcount
00:00
5 left

SQL Aggregation for HR Headcount

EasySQL · PostgreSQL

Problem

Write a SQL query to find the total number of employees working in the HR department from an employees table.

Use the employees table and count only rows whose department is HR.

Output

  1. Return one row with a column named total_employees.
  2. The value must be the total count of HR employees.

Schema

employees
ColumnTypeDescription
employee_idPKINTEGERUnique employee identifier
employee_nameVARCHAR(100)Employee's full name
departmentVARCHAR(50)Department assigned to the employee
Tablesemployees
Interviewer

Your question is SQL Aggregation for HR Headcount. Start with the requirements and the one table in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.