Introduction to SQL Exercises
Answer these questions using the Northwind database provided on your couse
- Basic Database Queries
- Our company is rapidly growing. The board of directors wants to
know in how many countries we already have customers. Please provide
them with an accurate figure.
- In how many different countries do we have supplier contacts.
- We currently have only few employees. In which countries do they
- How many customers do we have in the USA?
- Trying to assess the risk of the current crisis in Ukraine, how
many customers do we have in Poland, Finland and Sweden combined?
- Do we have any suppliers in Scandinavia outside of Norway?
- Which CUSTOMER_IDs did post the top three orders with the
- Which products are currently out of stock?
- Are all of our employees responsible for at least one order
since the start of 2016?
- Adding Data
- Add yourself and your neighbour to the Employees table.
- Enter a new region "EMEA" into the regions table.
- Add "Styria" to the Territories so that it belongs to "EMEA".
- Update Data
- Nobody really uses fax anymore. Update the customers table to delete
the value in the fax column for each customer.
- Customer "Berglunds snabbköp" has a new address. Their headquarters
are now in "Olof Palmes gata 17" in 90323 Umeå. Update the customer
table accordingly using SQL.
- Update all employees in the "British Isles" region to henceforth
be in the "Great Britain" region.
- Remove Rows
We need to perform maintenance work and delete lots of old orders.
Remove all rows from the Orders table that have an order date
For reporting to senior management, generate a table containing
order details with the 10 highest unit prices. Create a second query
to highlight the 10 highest discounts.
- Create a query that only shows the product id and unit price of the
product with the highest unit price.
- Calculate the turnover of all orders ever made (the sum of the
product of unitprice and quantity of all items ever ordered). Call
this value Turnover using an alias.