Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Running Total of Incidents by Day

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Running Total of Incidents by Day. Start with the requirements and the two tables on the right.

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.

Problem

Cloud Security Services needs a daily view of incidents handled by its security teams. Write a PostgreSQL query that counts incidents for the requested reporting period and calculates the cumulative total over time.

Requirements

  1. Include only incidents assigned to teams whose service_area is Cloud Security Services.
  2. Restrict results to February 1 through February 5, 2025, using an inclusive start and exclusive end boundary.
  3. Return one row per day with the daily incident count and a running total ordered chronologically.

Schema

incidents
ColumnTypeDescription
incident_idPKINTUnique incident identifier
team_idINTAssigned security team identifier
occurred_atDATEDate the incident occurred
severityVARCHAR(20)Incident severity
security_teams
ColumnTypeDescription
team_idPKINTUnique team identifier
team_nameVARCHAR(100)Security team name
service_areaVARCHAR(100)Service area supported by the team
Tablesincidentssecurity_teams
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results