Using Non-equi Joins in SQL
📖 Scenario: You work for a retail company that wants to categorize products based on their price ranges. The company has a table of products with their prices and a separate table defining price categories with minimum and maximum price limits.Your task is to join these two tables to assign each product to the correct price category using a non-equi join.
🎯 Goal: Create a SQL query that uses a non-equi join to match each product with the correct price category based on its price.
📋 What You'll Learn
Create a
products table with columns product_id, product_name, and price.Create a
price_categories table with columns category_id, category_name, min_price, and max_price.Write a SQL query that joins
products and price_categories using a non-equi join condition on price between min_price and max_price.Select
product_name and category_name in the final output.💡 Why This Matters
🌍 Real World
Retail companies often categorize products by price ranges to help customers filter and compare items easily.
💼 Career
Understanding non-equi joins is important for data analysts and database developers who work with complex data relationships that are not simple equals.
Progress0 / 4 steps