Sorting Products by Price and Name
📖 Scenario: You are managing a small online store database. You want to organize your product list so that it is easy to find items by price and name.
🎯 Goal: Build SQL queries that sort products by their price in ascending order and by their name in descending order.
📋 What You'll Learn
Create a table called
products with columns id, name, and price.Insert exactly three products with specified names and prices.
Write a query to select all products ordered by
price in ascending order.Write a query to select all products ordered by
name in descending order.💡 Why This Matters
🌍 Real World
Sorting data is a common task in databases to help users find information quickly, like sorting products by price or name in an online store.
💼 Career
Knowing how to use ORDER BY with ASC and DESC is essential for database querying roles, data analysis, and backend development.
Progress0 / 4 steps