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
Sagaidāmais izvades paraugs
Tā izskatās pareiza atbilde — tās rindu skaits ir pašai savs, tam nav jāatbilst shēmas tabulām.
| id |
|---|
| 1 |
| 2 |
| 3 |
Pieslēdzies, lai redzētu iesniegumu vēsturi
PieslēgtiesPieslēdzies, lai izmantotu AI mentoru
Pieslēgties