Week 1 exercises

Let's get some exercise!

Use the editor on this page to answer some questions from the Chinook database. Write down your answers using the Template.

Think about what the question asks you to do. Are you simply displaying the data, or are you filtering, and/or sorting?

This is also a chance for you to practice formatting your code properly. And remember - if you have any questions, just ask me!

Here's one thing I want you think really hard about: How will you make sure that the results you get are the right results?

Questions:

  1. What are the media types in the MediaType table? Use a SELECT statement to show them.
  2. What are the employees' full names? Show this in a single column called "Employee Names". Note: don't forget to put a space between first and last names, or a comma and a space if you put the last name first.
  3. Select the sum of 987 plus 789, divided by 111. Hint: it's 16 - don't forget about BEDMAS!.
  4. Select the rows for all the customers in Brazil and Canada.
  5. Who are all the customers with hotmail addresses? Hint: there are other hotmail "top level domains" besides '.com', for example "hotmail.co.uk".
  6. Who are all the customers who don't have a company listed?
  7. What are the genres whose name begins with a letter in the second half of the alphabet?
  8. List the cities with employees, reverse alphabetically. Hint: a list of things shouldn't contain duplicates.

As a reminder, here are the names of the tables in the Chinook database:
Artist
Album
Customer
Employee
Genre
Invoice
InvoiceLine
MediaType
Playlist
PlaylistTrack
Track