Sorting Products by Category and Price
📖 Scenario: You are managing a small online store database. You want to organize your product list so that products are grouped by their category and then sorted by price within each category.
🎯 Goal: Create a SQL query that orders products first by their category in alphabetical order, and then by price in ascending order within each category.
📋 What You'll Learn
Create a table called
products with columns id (integer), name (text), category (text), and price (decimal).Insert the exact product data provided.
Write a SQL query that selects all columns from
products and orders the results by category ascending and then price ascending.💡 Why This Matters
🌍 Real World
Sorting products by category and price helps customers find items easily in online stores.
💼 Career
Knowing how to order query results by multiple columns is a common task for database administrators and developers.
Progress0 / 4 steps