Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL for Weekly Completion Rates
00:00
5 left

SQL for Weekly Completion Rates

MediumSQL · PostgreSQL

Problem

Write a SQL query to analyze operational performance by joining member, queue, and outcome tables and calculating weekly completion rates.

Use the provided tables to calculate results for every queue and every week represented by valid member outcomes. Treat an outcome with status completed as completed. Include queues with no outcomes in a represented week.

Output

  1. One row per queue and week, with columns queue_name, week_start, total_outcomes, completed_outcomes, and completion_rate.
  2. Include weeks beginning Monday, order by week_start, then queue_name.
  3. Return completion rates as percentages rounded to two decimal places, using 0.00 when no outcomes exist.

Schema

members
ColumnTypeDescription
member_idPKINTUnique member identifier
member_nameVARCHAR(100)Member display name
queues
ColumnTypeDescription
queue_idPKINTUnique operational queue identifier
queue_nameVARCHAR(100)Operational queue name
outcomes
ColumnTypeDescription
outcome_idPKINTUnique outcome identifier
member_idINTMember associated with the outcome
queue_idINTQueue that handled the outcome
outcome_atTIMESTAMPTimestamp when the outcome was recorded
outcome_statusVARCHAR(30)Outcome status, such as completed, pending, or failed
Tablesmembersqueuesoutcomes
Interviewer

Your question is SQL for Weekly Completion Rates. Start with the requirements and the three tables in the Question tab.

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.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.