Using MIN and MAX Functions in SQL
📖 Scenario: You are managing a small bookstore database. You want to find the lowest and highest prices of books available to help set promotional discounts and premium pricing.
🎯 Goal: Build SQL queries using MIN and MAX functions to find the cheapest and most expensive book prices from the bookstore's inventory.
📋 What You'll Learn
Create a table called
books with columns id, title, and priceInsert 5 specific book records with given prices
Write a query to find the minimum book price using
MIN(price)Write a query to find the maximum book price using
MAX(price)💡 Why This Matters
🌍 Real World
Finding minimum and maximum values is common in business to identify price ranges, sales extremes, or performance metrics.
💼 Career
Database professionals often use MIN and MAX functions to generate reports and insights from data.
Progress0 / 4 steps