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
Get started
SQL Report With Missing Addresses
00:00
5 left

SQL Report With Missing Addresses

EasySQL · PostgreSQL

Problem

PlayStation QA needs a profile coverage report for PlayStation Network accounts. Write a PostgreSQL query that returns every person, whether or not a matching address exists.

Requirements

  1. Return FirstName, LastName, City, and State for every row in person.
  2. Preserve people without an address, showing NULL for missing address fields.
  3. Order the report by person_id ascending so the output is deterministic.

Use a join that does not accidentally exclude profiles lacking address records.

Schema

person
ColumnTypeDescription
person_idPKINTEGERUnique person identifier
first_nameVARCHAR(50)Person's first name
last_nameVARCHAR(50)Person's last name
address
ColumnTypeDescription
address_idPKINTEGERUnique address identifier
person_idINTEGERPerson associated with the address
cityVARCHAR(100)City in the profile address
stateVARCHAR(100)State, province, or region
Tablespersonaddress
Interviewer

Your question is SQL Report With Missing Addresses. Start with the requirements and the two 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
Sign up free to run your codeLog inLn 1
Run your query to see results here.