Posts

Showing posts from March, 2026

SQL handouts

https://drive.google.com/file/d/1vyDyIKJP_83tlHc7uYOnVj0zS1C7HEEn/view?usp=sharing CSV Dataset https://drive.google.com/file/d/1EnaYj5VCTLIn9dVAOsIFlhNt9V1Vww_Z/view?usp=sharing  1. Basic SELECT and WHERE Show all columns for orders from the North region. List Order_ID and Profit for orders where Profit is greater than 500. Retrieve all orders for Product_ID = 'P02'. 2. Calculations and Aliases Select Order_ID, Units_Sold, Unit_Price, and calculate Total_Amount as Units_Sold * Unit_Price. Find Revenue minus Cost for each order and show it as Calculated_Profit. Check if it matches the Profit column. 3. Filtering by Date and Numeric Ranges Select all orders placed on or after '2025-02-01'. Get orders where Units_Sold between 2 and 7 (inclusive). 4. GROUP BY and Aggregation Find total Revenue per Region. Find total Profit per Salesperson_ID. Find total Units_Sold for each Product_ID. 5. HAVING and Aggregated Filters Show Region and total Profit, but only for regions wh...