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:
- What are the media types in the MediaType table? Use a
SELECT
statement to show them. - 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.
- Select the sum of 987 plus 789, divided by 111. Hint: it's 16 - don't forget about BEDMAS!.
- Select the rows for all the customers in Brazil and Canada.
- Who are all the customers with hotmail addresses? Hint: there are other hotmail "top level domains" besides '.com', for example "hotmail.co.uk".
- Who are all the customers who don't have a company listed?
- What are the genres whose name begins with a letter in the second half of the alphabet?
- 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 |