List the Products Sold

ASKED IN INTERVIEW
2pts
Shopify

Problem Statement

Shopify store owners want to see a list of products that are currently active. Write an SQL query to find all products that have been sold at least once in the last 7 days (including today, 2026-02-09).

Rules:

  • The time window is 2026-02-03 to 2026-02-09.
  • Only return unique product names.
  • Output column: product_name.
  • Results must be sorted by product_name in ascending order.
Tests your understanding of
Date Filtering, Distinct and Sorting

Input Tables

Products
product_id(INTEGER)product_name(VARCHAR)category(VARCHAR)
1Leather BootsFootwear
2Silk ScarfAccessories
3Wool HatAccessories
Orders
order_id(INTEGER)product_id(INTEGER)sale_date(DATE)
50112026-02-08
50212026-02-07
50322026-02-04
50432026-01-20
Stock_Levels
product_id(INTEGER)quantity_remaining(INTEGER)
150
210
35

Expected Output

product_name(VARCHAR)
Leather Boots
Silk Scarf

Tags

EasyASKED IN INTERVIEWDate FilteringDistinctSorting
5-10 min
88%

Hints