Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Customers With No Recent Orders

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

Your question is Customers With No Recent Orders. 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

Vanguard Personal Investor wants to identify customers who may need re-engagement. Using the customer and order data below, write a PostgreSQL query that finds every customer who has not placed an order during the six-month period ending on 2026-08-29.

Requirements

  1. Return every qualifying customer, including customers who have never placed an order.
  2. Include the customer ID, customer name, and their most recent order date across all available history.
  3. Treat an order with a NULL order date as not occurring within the six-month period.
  4. Sort the output alphabetically by customer name, then by customer ID.

Schema

customers
ColumnTypeDescription
customer_idPKINTEGERUnique Vanguard customer identifier
customer_nameVARCHAR(100)Customer's full name
joined_dateDATEDate the customer joined Vanguard Personal Investor
orders
ColumnTypeDescription
order_idPKINTEGERUnique order identifier
customer_idINTEGERCustomer who placed the order
order_dateDATEDate the order was placed
order_statusVARCHAR(20)Current order status
Tablescustomersorders
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results