Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Missing Values in Required Join Column

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

Your question is Missing Values in Required Join Column. Start with the requirements and the two 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

Context

Apex Systems QA reporting needs to flag test runs that cannot be linked to a defined test case. These records should be identified before execution results are included in quality metrics.

Task

Write a PostgreSQL query that returns QA test runs where the required test_case_id join column is NULL. Preserve the run record even though it has no matching test case.

Requirements

  1. Use a LEFT JOIN from test_runs to test_cases.
  2. Return the run ID, missing join column, environment, run status, and test case name.
  3. Filter only rows where test_runs.test_case_id IS NULL.
  4. Order the results by run_id ascending.

Schema

test_runs
ColumnTypeDescription
run_idPKINTUnique identifier for the test run
test_case_idINTRequired reference to test_cases.test_case_id
environmentVARCHAR(30)Environment where the test ran
statusVARCHAR(20)Execution status
test_cases
ColumnTypeDescription
test_case_idPKINTUnique test case identifier
test_case_nameVARCHAR(150)Descriptive QA test case title
componentVARCHAR(60)Application component under test
Tablestest_runstest_cases
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results