FastPrepCustomers Who Bought at Most One Product
Problems/Customers Who Bought at Most One Product

Customers Who Bought at Most One Product

Expedia logoExpedia● EasyINTERNOA

Updated Nov 2026

QuestionConstraints

Problem statement

Source note: A 2023 Expedia online coding round for SDE interns had a short SQL task on two tables: customers, and the products each customer bought. You list the customers with no more than one purchase, by name in alphabetical order.

The report does not give exact table or column names, the limits, or what happens with repeated names. Here, purchases has one row per product bought. A customer with no purchases counts, because zero is at most one. A customer never buys the same product twice. Two customers with the same name each get their own row.

Our version is about 90% the same as the reported question.

The customers table has one row per customer: a unique customer_id and the customer_name.

The purchases table has one row for each product a customer bought: a unique purchase_id, the customer_id of the buyer, and the product_name.

Find every customer who bought at most one product. A customer who bought nothing has bought zero products, so that customer counts too.

Return one column, customer_name, with one row per matching customer. Two different customers can have the same name; list each of them. Sort the rows by customer_name from A to Z.

Table schema

MySQLPostgreSQLPandas

Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.

customers

One row per customer.

ColumnTypeNullableDescription
customer_idPKIntegerNo—
customer_nameTextNo—

purchases

One row for each product a customer bought.

ColumnTypeNullableDescription
purchase_idPKIntegerNo—
customer_idIntegerNo—
product_nameTextNo—

Foreign key: customer_id → customers(customer_id)

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
customer_nameTextNo—

Row order: must match exactly. Numeric tolerance: 0.

Constraints

  • Each table has from 0 to 1000 rows.
  • customer_id is unique in customers, and purchase_id is unique in purchases.
  • 1 <= customer_id, purchase_id <= 10^6
  • Every customer_id in purchases also appears in customers.
  • A customer buys a given product_name at most once.
  • customer_name is one uppercase English letter followed by 0 to 19 lowercase English letters. Names can repeat.
  • product_name has 1 to 20 lowercase English letters.
  • No value is NULL.

More Expedia Online Assessment questions

  • Balanced NumbersOA · Seen Aug 2026
  • REST API: Discounted PriceOA · Seen Aug 2026
  • Maximum Team SizeOA · Seen Mar 2026
  • Per-Domain Request LimiterOA · Seen Oct 2025
  • Count Equal-Frequency SubsequencesOA · Seen Mar 2025
  • Count Increasing Stock PeriodsOA · Seen Mar 2025
  • Get Minimum StepsOA · Seen Oct 2024
  • Rank Songs by PopularityOA · Seen Oct 2024
  • Calculate the SumOA · Seen Oct 2024
  • Get Maximum EfficiencyOA · Seen Oct 2024

Similar questions at other companies

  • Students Scoring Above AverageCapstone Investment Advisors · OA
  • Bond Interest Summary Above 3%Wells Fargo · OAWells Fargo interview questions
  • Employee Promotion OpportunitiesIntuit · OAIntuit interview questions
  • Students and Their SubjectsBirla Pivot · OA
  • Companies with Average Salary Above 40000AT&T · OAAT&T interview questions
  • Build Taxi Driver Performance FeaturesBoston Consulting Group · OABoston Consulting Group interview questions
  • Weekend Appointments for Consular Services ReschedulingMcKinsey & Company · OAMcKinsey & Company interview questions
  • Companies Above a Salary ThresholdVerisk · OA
  • Customer Resource Usage AnalysisIBM · OAIBM interview questions
  • Customers Who Never OrderedAccenture · OAAccenture interview questions

Interview reports that mention this question

  • Expedia Intern Final Round in 2023: 17 Experiences (Part 2 of 6)

Expedia interview experiences

  • Expedia Intern Final Round in 2021: 28 Experiences (Part 4 of 6)
  • Expedia Intern Finals Before 2020: 14 Experiences (Part 6 of 6)
  • Expedia Intern Final Round in 2020: 24 Experiences (Part 5 of 6)
  • Expedia Intern Final Round in 2022: 15 Experiences (Part 3 of 6)
  • Expedia SWE Intern Final Round: 126 Experiences (Part 1 of 6)
All Expedia interview questionsSee Expedia hiring insights