Back to Practice
#0319

Products Never Sold

EasySQL15 min10 XP

Problem

Return product names that never appear in sales, ordered by product.

Why This Matters

SQL interviews usually test whether you can turn a business question into the right rows, grouping level, join type, and edge-case behavior.

Schema

products(product_id INTEGER, product TEXT); sales(sale_id INTEGER, product_id INTEGER)

Examples

Example 1
InputBag has no sale row
OutputBag

The unmatched product has NULL sale_id after the LEFT JOIN.

Constraints

  • Return only the requested columns.
  • Use deterministic ORDER BY when multiple rows are returned.
  • Assume SQLite-compatible SQL unless the prompt states otherwise.
CodeSQL
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core SQL case
InputBag has no sale row
Expected[["Bag"]]

The unmatched product has NULL sale_id after the LEFT JOIN.

Hidden Test Categories
Empty or missing matchesDuplicate rows or tiesNULL values where the pattern commonly breaks