Second most expensive product
Hard
Show the name and price of the product with the second highest price.
Tables: customers(customer_id, name, city, country, joined) · products(product_id, name, category, price) · orders(order_id, customer_id, order_date, status) · order_items(order_id, product_id, quantity, unit_price)
Your query✔ Solved
Show the expected result
| name | price |
|---|---|
| Ergonomic chair | 399.0 |
1 row
Show a solution
SELECT name, price FROM products WHERE price = (SELECT DISTINCT price FROM products ORDER BY price DESC LIMIT 1 OFFSET 1);
SQL used
New to SQL? The free SQL course teaches everything these problems use, with a self-checking exercise in every lesson.