Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Reconcile Survey Responses with Source Records

Medium
SQL & Data ManipulationData WranglingCTEsAggregations
Asked 2mo ago|McKinsey & Company
Asked 1 times

Problem

You are reviewing a research extract before it is used in an analysis in McKinsey &'s internal knowledge workflow. Write a SQL query that returns each project with the number of survey responses, the number of valid responses, and a data quality status. A response is valid only when it belongs to an existing project, has a non-null respondent email, and its submitted date is on or after the project start date. Return only projects that have at least 2 responses in total, including invalid ones.

Use the project list as the base table so projects with responses still appear even if some responses are invalid. Classify each returned project as accurate when all its responses are valid, review when at least one response is invalid but at least one is valid, and critical when none of its responses are valid.

Schema

projects
ColumnTypeDescription
project_idPKINTProject identifier
project_nameVARCHAR(100)Project name
start_dateDATEProject start date
office_codeVARCHAR(20)Office owning the project
survey_responses
ColumnTypeDescription
response_idPKINTResponse identifier
project_idINTReferenced project identifier
respondent_emailVARCHAR(150)Respondent email
submitted_atDATESubmission date
scoreINTSurvey score

You are practicing as a guest. Sign up free to run your code against the sample data. Your draft stays right here.

Sign up freeI have an account
SELECT ...
FROM ...
JOIN ... ON ...
GROUP BY ...
HAVING ...
ORDER BY ... DESC;
Sign up to unlock solutions
McKinsey & Research Analyst Interview Questions
Next questions
First Trust Capital ManagementReconciling Disparate SourcesMediumZoetisReconcile Conflicting Data SourcesHardAmerican Family InsuranceClean Survey Responses for ReportingHard
PostgreSQL