Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Project Data Collection With SQL
00:00
5 left

Project Data Collection With SQL

MediumSQL · PostgreSQL

Problem

Tell me about your projects and how you collect, clean, and manipulate data using SQL.

Use the provided project, batch, and cleaning-event tables to demonstrate the SQL work behind that process. Write a query that summarizes first-quarter 2025 collection and cleaning activity for every project.

Output

  1. One row per project, including projects without qualifying batches.
  2. Return project_id, project_name, collected_rows, valid_rows, cleaned_rows, validation_rate, and latest_cleaned_at.
  3. Treat missing numeric totals as zero, return NULL for validation_rate when no rows were collected, and order by project_id ascending.

Schema

projects
ColumnTypeDescription
project_idPKINTUnique project identifier
project_nameVARCHAR(100)Project name
owner_nameVARCHAR(100)Project owner
data_batches
ColumnTypeDescription
batch_idPKINTUnique collected data batch identifier
project_idINTProject associated with the batch
source_nameVARCHAR(100)Data collection source
collected_atDATEDate the batch was collected
rows_collectedINTNumber of rows collected
rows_validINTNumber of rows passing validation
cleaning_events
ColumnTypeDescription
event_idPKINTUnique cleaning event identifier
batch_idINTBatch affected by the event
event_typeVARCHAR(50)Type of cleaning or validation action
affected_rowsINTNumber of rows affected
event_dateDATEDate of the cleaning event
Tablesprojectsdata_batchescleaning_events
Interviewer

Your question is Project Data Collection With SQL. 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.