Medium
SQL-J08sqlProducts With Recent Sales
Problem
List products that had at least one sale in the **last 30 days**. Return `id, name` ordered by name. Use a SEMI-JOIN pattern (EXISTS or IN with subquery).
Input
products(id, name), sales(product_id, sold_on)
Output
id, name
Constraints
1 ≤ rows ≤ 10^6
Sample input
see prompt
Sample output
...
Explanation
EXISTS short-circuits — once a single match is found per outer row, scanning stops.
joinssemi-joinexists@Walmart
Visible test cases
in: see
out: ...
Your solution — run it, use AI if stuck
sql
