This repository contains a collection of SQL queries written for the Northwind database. The Northwind database is a sample database commonly used for learning and practicing SQL.
The queries in this repository cover a wide range of scenarios and aim to provide insights and analysis on the Northwind database. Each query is numbered and has a corresponding description of its purpose.
- Get the total number of orders placed by each customer
- Find all suppliers who provide products in the 'Seafood' category
- Get the total quantity of each product sold
- Find the total sales (Quantity * Unit_Price) for each category of products
- List the employees and the number of orders each employee has taken
- Get the customers who have placed more than 10 orders
- Get the top 5 most sold products
- Find the products that have never been ordered
- Find the customers who have not placed any orders
- List all 'Orders' with 'Customer' details and 'Employee' who processed it
- Calculate the average product price by category
- Find the total revenue generated by each employee
- List all orders shipped to 'Germany'
- Find the most expensive product in each category
- Find the total revenue for the year 2016
- List all products that are discontinued
- List all the distinct countries to which orders have been shipped
- Find all employees who report to 'Andrew Fuller'
- Find the customers who have spent more than $5000 in total
- List the top 5 employees who have processed the most orders
- Get the list of customers who have ordered 'Chai' product
- Get the employees who have processed orders for 'Chai' product
- Find the most common shipping country
- Find the order with the highest total cost
- Find the employees who have processed more than 100 orders
- Find the customer who has ordered the most 'Chai' product
- Find the average quantity of products ordered in each order
- Find the top 3 most popular categories of products ordered
- Find the month in the year 2016 with the highest total sales
- Find the employee who processed the most orders in August 2016
- Find the top 3 customers who have ordered the most products
- Find the employees who have not processed any orders
- Find the suppliers who supply the top 5 most sold products
- Find the customers who have ordered products from all categories
- Find the total sales for each year
- Classify customers based on their total order amounts such that total order amounts > 5000 should be classified as 'High Value', if > 1000 then as 'Medium Value', and otherwise as 'Low Value'
- Classify products based on their sales volume such that TotalQuantity > 1000 is classified as 'High Sales'. If TotalQuantity > 500, it is classified as 'Medium Sales', and otherwise as 'Lower Sales'
- Classify employees based on the number of orders they have processed such that NumberOfOrders > 100 is classified as 'High Performing'. If NumberOfOrders > 50, it is classified as 'Medium Performing', and otherwise as 'Lower Performing'
- The Northwind database used in this repository is a sample database provided by Microsoft. It serves as a useful resource for learning and practicing SQL.
- SQL-Practise Website.