Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Start free
SQL for Implementation Progress
00:00
5 left

SQL for Implementation Progress

HardSQL · PostgreSQL

Problem

Write a SQL query to track weekly implementation progress, joining client, project, and usage tables to calculate completion rate and identify at-risk accounts for Commure.

Use active projects and implementation usage from the reporting weeks beginning January 6, January 13, and January 20, 2025. An account is at risk when cumulative completion is below 80% of the expected completion pace.

Output

  1. One row per active project and reporting week.
  2. Columns: client_name, project_name, week_start, weekly_units, cumulative_units, completion_rate, and risk_status.
  3. Include projects with no usage, show rates as percentages, and order by client name, project name, and week start.

Output details

  • Include each active project only from the week containing its start_date through the week on or before its target_date, inclusively.
  • Restrict usage dates to 2025-01-06 inclusive through 2025-01-27 exclusive.
  • Represent missing weekly_units as 0 and calculate cumulative_units from those zero-filled values.
  • Round completion_rate to two decimal places, returning a NULL rate when planned_units is zero.
  • Compute expected pace as elapsed project days divided by total project days, clamped between 0 and 1, and compare completion against 80% of that pace.
  • Order client_name, project_name, and week_start ascending.

Schema

clients
ColumnTypeDescription
client_idPKINTUnique client identifier
client_nameVARCHAR(120)Commure client account name
regionVARCHAR(40)Client operating region
projects
ColumnTypeDescription
project_idPKINTUnique implementation project identifier
client_idINTClient owning the project
project_nameVARCHAR(120)Implementation project name
planned_unitsINTTotal implementation units planned
start_dateDATEProject start date
target_dateDATETarget completion date
statusVARCHAR(20)Current project status
usage
ColumnTypeDescription
usage_idPKINTUnique usage record identifier
project_idINTProject associated with the usage record
usage_dateDATEDate of implementation activity
units_completedINTImplementation units completed in the activity
Tablesclientsprojectsusage
Interviewer

Whenever you're ready, walk me through your approach or go straight to the code. The requirements and the three tables are in the Question tab.

Sign up free to run or submit. Log in
CodePostgreSQL
Sign up free to run your code. Your draft is saved.Run with a free accountLog inLn 1
Run your query to see results here.