Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Summarize Operations Issues by Source

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

Your question is Summarize Operations Issues by Source. Start with the requirements and the three 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

Acme Manufacturing tracks operational issues by source system. Write a PostgreSQL query to summarize issue volume and resolution speed for sources that currently have at least one open issue.

Requirements

  1. Return one row per source_name.
  2. Show the count of open issues as open_issue_count.
  3. Show the count of open high-severity issues as high_open_issue_count.
  4. Show the average number of days to resolve closed issues as avg_resolution_days, rounded to 1 decimal place.
  5. Include only sources with at least one open issue.
  6. Order results by open_issue_count descending, then source_name ascending.

Schema

issues
ColumnTypeDescription
issue_idPKINTPrimary key for each issue
source_idINTForeign key to the issue source
severityVARCHAR(20)Severity label such as low, medium, or high
statusVARCHAR(20)Issue status such as open or closed
created_atDATEDate the issue was created
resolved_atDATEDate the issue was resolved, if closed
issue_sources
ColumnTypeDescription
source_idPKINTPrimary key for the issue source
source_nameVARCHAR(50)Human-readable source name
daily_activity
ColumnTypeDescription
activity_idPKINTPrimary key for the activity row
issue_idINTForeign key to the issue
activity_dateDATEDate of the activity
minutes_spentINTMinutes spent on the issue that day
Tablesissuesissue_sourcesdaily_activity
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results