Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Summarize Operations Issues by Source

MediumSQL · PostgreSQL00:00
I
Practice interviewer
Your interviewer
In session
I
Interviewer

Welcome to the SQL screen.

The question is on your right: Summarize Operations Issues by Source. Read through the requirements and the three tables first.

Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?

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