easy

Employees Hired in the Last 90 Days

You are working as a data analyst for BrightForce HR, a mid-sized technology company. The HR team needs a quick report to identify all employees who joined the company within the last 90 days. This helps the onboarding team track new hires and ensure they are receiving proper orientation and training support.

The database contains an employees table that tracks all staff members across various departments. Each row represents one employee and includes their personal details, department assignment, job title, and the date they were hired.

Schema Summary:
Table: employees

  • employee_id — Primary key, unique identifier for each employee

  • full_name — Full name of the employee

  • department — Department the employee belongs to (e.g., Engineering, Marketing)

  • job_title — Employee's job title

  • hire_date — The date the employee was hired (type: DATE)

  • salary — Monthly salary in USD

Requirements:

  • Return all employees whose hire_date falls within the last 90 days from today

  • Include the following columns in the result: employee_id, full_name, department, job_title, and hire_date

  • Sort the results by hire_date in descending order (most recently hired first)

Hints & Common Pitfalls: Use CURRENT_DATE in PostgreSQL to get today's date — avoid hardcoding dates, as that makes queries brittle. To subtract 90 days from today, use the expression CURRENT_DATE - INTERVAL '90 days'. A common mistake is using NOW() which returns a timestamp — this can cause subtle comparison issues with a DATE column; prefer CURRENT_DATE for date-only comparisons.

1
2
3
4
5
Preparing...
Employees Hired in the Last 90 Days

You are working as a data analyst for BrightForce HR , a mid-sized technology company. The HR team needs a quick report to identify all employees who joined the company within the last 90 days. This helps the onboarding team track new hires and ensure they are receiving proper orientation and training support. The database contains an employees table that tracks all staff members across various departments. Each row represents one employee and includes their personal details, department assignment, job title, and the date they were hired. Schema Summary: Table: employees employee_id — Primary key, unique identifier for each employee full_name — Full name of the employee department — Department the employee belongs to (e.g., Engineering, Marketing) job_title — Employee's job title hire_date — The date the employee was hired (type: DATE) salary — Monthly salary in USD Requirements: Return all employees whose hire_date falls within the last 90 days from today Include the following columns in the result: employee_id , full_name , department , job_title , and hire_date Sort the results by hire_date in descending order (most recently hired first) Hints & Common Pitfalls: Use CURRENT_DATE in PostgreSQL to get today's date — avoid hardcoding dates, as that makes queries brittle. To subtract 90 days from today, use the expression CURRENT_DATE - INTERVAL '90 days' . A common mistake is using NOW() which returns a timestamp — this can cause subtle comparison issues with a DATE column; prefer CURRENT_DATE for date-only comparisons.

Table Setup (SQL Schema)

CREATE TABLE employees (
  employee_id SERIAL PRIMARY KEY,
  full_name VARCHAR(100) NOT NULL,
  department VARCHAR(50) NOT NULL,
  job_title VARCHAR(100) NOT NULL,
  hire_date DATE NOT NULL,
  salary NUMERIC(10, 2) NOT NULL
);

INSERT INTO employees (full_name, department, job_title, hire_date, salary) VALUES
  ('Aisha Kapoor', 'Engineering', 'Backend Engineer', CURRENT_DATE - INTERVAL '10 days', 95000),
  ('Liam Oduya', 'Marketing', 'Growth Analyst', CURRENT_DATE - INTERVAL '45 days', 72000),
  ('Sara Mendez', 'Engineering', 'Frontend Engineer', CURRENT_DATE - INTERVAL '80 days', 91000),
  ('James Whitfield', 'HR', 'Recruiter', CURRENT_DATE - INTERVAL '95 days', 68000),
  ('Priya Nair', 'Data', 'Data Engineer', CURRENT_DATE - INTERVAL '120 days', 105000),
  ('Tom Eriksson', 'Sales', 'Account Executive', CURRENT_DATE - INTERVAL '30 days', 78000),
  ('Fatima Al-Hassan', 'Design', 'UX Designer', CURRENT_DATE - INTERVAL '5 days', 88000),
  ('Carlos Vega', 'Engineering', 'DevOps Engineer', CURRENT_DATE - INTERVAL '200 days', 102000),
  ('Nina Patel', 'Marketing', 'Content Strategist', CURRENT_DATE - INTERVAL '60 days', 70000),
  ('David Osei', 'Sales', 'Sales Manager', CURRENT_DATE - INTERVAL '365 days', 115000);
Home Videos Quiz Blog