Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Find Customers Missing in Another Table

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

Your question is Find Customers Missing in Another Table. 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

Gartner wants to identify active customer accounts in its CRM that have no recorded login to Gartner Digital Markets. Write a PostgreSQL query that returns customers present in the customers table but absent from gartner_logins.

Requirements

  1. Return only customers whose account_status is Active.
  2. Exclude any customer with at least one matching login record.
  3. Return customer_id, customer_name, and account_status, ordered by customer_id ascending.

Schema

customers
ColumnTypeDescription
customer_idPKINTUnique customer identifier
customer_nameVARCHAR(100)Customer account name
account_statusVARCHAR(20)Current CRM account status
gartner_logins
ColumnTypeDescription
login_idPKINTUnique login event identifier
customer_idINTCustomer associated with the login, if known
product_nameVARCHAR(100)Gartner product accessed
Tablescustomersgartner_logins
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results