SQL · Module 2
Answers and explanations · Select only the evidence you need
Compare these references after your own attempt. You can read them at any time; they do not record a live model or vendor run.
SQL · Module 2
Compare these references after your own attempt. You can read them at any time; they do not record a live model or vendor run.
Bag and Guide are the most expensive catalogue products. Sorting by product_id after price makes any future ties deterministic.
SELECT product_id,product_name,list_price FROM aabha_sql.products ORDER BY list_price DESC,product_id LIMIT 2;
Expected output:
| product_id | product_name | list_price |
|---|---|---|
| 104 | Bag | 800.00 |
| 105 | Guide | 500.00 |
Runnable answer: sql/solutions/02a.sql
The result contains app and web once each. DISTINCT applies to the one selected column.
SELECT DISTINCT channel FROM aabha_sql.orders ORDER BY channel;
Expected output:
| channel |
|---|
| app |
| web |
Runnable answer: sql/solutions/02b.sql