Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Start free
SQL Join to Find Missing Rows
00:00
5 left

SQL Join to Find Missing Rows

EasySQL · PostgreSQL

Problem

There is a list of SQL operations across multiple tables; write the final SQL to select records from table 1 that do not have a record in table 2.

Use the provided schemas and match records by record_id and table_1_id.

Output

  1. One row per unmatched table_1 record.
  2. Return record_id, record_name, and source_system.
  3. Sort by record_id in ascending order.

Schema

table_1
ColumnTypeDescription
record_idPKINTUnique identifier for a table_1 record
record_nameVARCHAR(100)Display name of the record
source_systemVARCHAR(50)System that supplied the record
table_2
ColumnTypeDescription
table_2_idPKINTUnique identifier for a table_2 record
table_1_idINTReferenced record_id from table_1
noteVARCHAR(200)Optional note associated with the table_2 record
Tablestable_1table_2
Interviewer

Whenever you're ready, walk me through your approach or go straight to the code. The requirements and the two tables are in the Question tab.

Sign up free to run or submit. Log in
CodePostgreSQL
Sign up free to run your code. Your draft is saved.Run with a free accountLog inLn 1
Run your query to see results here.