Calculate Cumulative Hires in Employees Table

Calculate the cumulative number of employees hired over time.

sql

SELECT hired_at, COUNT(id) OVER (ORDER BY hired_at) AS cumulative_employees FROM employees;

This query uses a window function to calculate a running total of the "id" count from the "employees" table, ordered by the "hired_at" date.

PromptDB can make mistakes. Please double-check responses.