SQL-Practice-Problems-solution

This is my solution to Sylvia moestl vasilik SQL practice problems

About the book

The SQL practice problems consist of 57 select statement problems which ranges from beginners level select statement to advanced level select statement. Getting practice on real life data can be hard without working as a data analyst, engineer or programmer and the best way to learn is by practicing, so this book was written to introduce data enthusiasts to real life data problems.

A modified northwind database was used for this book. But the solution here is based on Microsoft sample Northwind database.

The 57 practice problems solved in this project include:

Introductory Problems

  1. Which shippers do we have?
  2. Certain fields from Categories
  3. Sales Representatives
  4. Sales Representatives in the United States
  5. Orders placed by specific EmployeeID
  6. Suppliers and ContactTitles
  7. Products with “queso” in ProductName
  8. Orders shipping to France or Belgium
  9. Orders shipping to any country in Latin America
  10. Employees, in order of age
  11. Showing only the Date with a DateTime field
  12. Employees full name
  13. OrderDetails amount per line item
  14. How many customers?
  15. When was the first order?
  16. Countries where there are customers
  17. Contact titles for customers
  18. Products with associated supplier names
  19. Orders and the Shipper that was used

Intermediate Problems

  1. Categories, and the total products in each category
  2. Total customers per country/city
  3. Products that need reordering
  4. Products that need reordering, continued
  5. Customer list by region
  6. High freight charges
  7. High freight charges - 2015
  8. High freight charges with between
  9. High freight charges - last year
  10. Inventory list
  11. Customers with no orders
  12. Customers with no orders for EmployeeID 4

Advanced Problems

  1. High-value customers
  2. High-value customers - total orders
  3. High-value customers - with discount
  4. Month-end orders
  5. Orders with many line items
  6. Orders - random assortment
  7. Orders - accidental double-entry
  8. Orders - accidental double-entry details
  9. Orders - accidental double-entry details, derived table
  10. Late orders
  11. Late orders - which employees?
  12. Late orders vs. total orders
  13. Late orders vs. total orders - missing employee
  14. Late orders vs. total orders - fix null
  15. Late orders vs. total orders - percentage
  16. Late orders vs. total orders - fix decimal
  17. Customer grouping
  18. Customer grouping - fix null
  19. Customer grouping with percentage
  20. Customer grouping - flexible
  21. Countries with suppliers or customers
  22. Countries with suppliers or customers, version 2
  23. Countries with suppliers or customers - version 3
  24. First order in each country
  25. Customers with multiple orders in 5 day period
  26. Customers with multiple orders in 5 day period, version 2