Products That Were Ordered
The catalog flags products that appear at least once in order_items. Rewrite the report in a set-based form and return the unique product id values, sorted by id.
Original query
SELECT p.id FROM products p WHERE EXISTS (SELECT 1 FROM order_items oi WHERE oi.product_id = p.id) ORDER BY p.id
Esempio di output atteso
Ecco come appare una risposta corretta — il suo numero di righe è a sé stante, non deve corrispondere alle tabelle dello schema.
| id |
|---|
| 1 |
| 2 |
| 3 |
Accedi per vedere la cronologia degli invii
AccediAccedi per usare l'AI Mentor
Accedi