Chapter 6 · Subqueries
06. Most Expensive Product Per Category
Medium20 XPE-Commerce
For each category, find the product with the highest price. Return the category name, product name, and price, sorted by price (highest first). Use a correlated subquery to identify the max-priced product.
Tables
- PKidINT
- nameTEXT
- descriptionTEXT
- PKidINT
- nameTEXT
- FKcategory_id→ categories.idINT
- priceREAL
- costREAL
- stock_quantityINT
- created_atTIMESTAMP
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.