You should already be connected up to the shared Chinook database for a small music store - like iTunes. Now fork and clone this lab and write out the SQL statements in queries.sql
to fulfill each of these queries:
1. Pull a list of all of genres from the database.
2. Pull all of the tracks.
3. How about just the tracks where the composer is AC/DC?
4. Pull all of the tracks greater than 3 minutes long. Hint: You’ll need to figure out how many milliseconds are in a minute.
5. Find the top 5 longest tracks. Hint: Look up how to use ORDER BY and ASC and DESC here
6. Find the top 5 shortest tracks.
Take a look at the customer table.
7. How many customers live in Brazil?
8. How many customers have gmail accounts? Hint: Look up how to use LIKE here
9. What’s the name of the customer who lives at “3 Chatham Street”?
10. Which artist created the album “Ace of Spades”?
11. How many albums does Nirvana have?
Bonus challenge:
- Use joins to find answers to the last two questions by only writing one query.
- Watch this video to learn about joining up tables.
- Or read this blogpost from a Flatiron alum.
- And take a look at this cheatsheet for an example of a join query.
SQL Cheat Sheet from a Flatiron Alum Select Statements
View Let's get ready to query!!! on Learn.co and start learning to code for free.