Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL Identify Missing Required Fields
00:00
5 left

SQL Identify Missing Required Fields

MediumSQL · PostgreSQL

Problem

Apex Systems QA engineers need to find incomplete test case records before a test cycle begins. Write a PostgreSQL query that checks required fields stored across test cases, assignments, and the latest test run.

Requirements

  1. Return only test cases missing at least one required value. Treat NULL and blank strings as missing.
  2. Check title, priority, tester_email, status, and executed_at.
  3. Use the latest run for each test case, while retaining test cases with no assignment or run.
  4. Return the test case ID, case key, and a comma-separated missing_fields list, ordered by case key.

Schema

test_cases
ColumnTypeDescription
test_case_idPKINTEGERUnique test case identifier
case_keyVARCHAR(20)Human-readable QA case key
titleVARCHAR(200)Test case title
priorityVARCHAR(20)Test priority
test_assignments
ColumnTypeDescription
assignment_idPKINTEGERUnique assignment identifier
test_case_idINTEGERAssigned test case identifier
tester_emailVARCHAR(150)Email address of the assigned QA tester
test_runs
ColumnTypeDescription
run_idPKINTEGERUnique test run identifier
test_case_idINTEGERExecuted test case identifier
statusVARCHAR(20)Execution status
executed_atTIMESTAMPTZExecution timestamp
Tablestest_casestest_assignmentstest_runs
Interviewer

Your question is SQL Identify Missing Required Fields. 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.