Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL for 7-Day Test Start

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is SQL for 7-Day Test Start. Start with the requirements and the three tables on the right.

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.

Problem

Turing's Product Growth team wants to identify candidates who completed their Turing profile but did not start the technical test within seven days of completion. Write a PostgreSQL query using the earliest profile completion per user.

Requirements

  1. Return each matching user's ID, name, and earliest profile completion timestamp.
  2. Exclude users who started any technical test from the completion timestamp through seven days afterward, inclusive.
  3. Include users with no technical test record, and sort results by profile completion time and user ID.

Schema

users
ColumnTypeDescription
user_idPKINTCandidate identifier
full_nameVARCHAR(100)Candidate full name
emailVARCHAR(255)Candidate email address
joined_atTIMESTAMPAccount creation timestamp
profile_completions
ColumnTypeDescription
completion_idPKINTProfile completion event identifier
user_idINTCandidate associated with the completion
completed_atTIMESTAMPProfile completion timestamp
technical_test_starts
ColumnTypeDescription
test_start_idPKINTTechnical test start event identifier
user_idINTCandidate who started the test
started_atTIMESTAMPTechnical test start timestamp
test_nameVARCHAR(100)Name of the Turing technical test
Tablesusersprofile_completionstechnical_test_starts
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results