- Install the SQLite Browser if you haven't already here
- Open the SQLite Browser and click 'File -> Open DataBase'
- Choose the
chinook.db
file from this repo. This database is open source and maintained by Microsoft (SQL is no fun if you don't have any data) - Click the tab that says 'Execute SQL'. Type SQL queries in the box above. Press the play button. See the results of that query in the box below
- Write the SQL to return all of the rows in the artists table?
- Write the SQL to select the artist with the name "Black Sabbath"
- Write the SQL to create a table named 'fans' with an autoincrementing ID that's a primary key and a name field of type text
- Write the SQL to alter the fans table to have a artist_id column type integer?
- Write the SQL to add yourself as a fan of the Black Eyed Peas? ArtistId 169
-
Check out the Faker gem.
gem install faker
, open up irb, runrequire 'faker'
and then generate a fake name for yourself usingFaker::Name.name
. How would you update your name in the fans table to be your new name? -
Write the SQL to return fans that are not fans of the black eyed peas.
- Write the SQL to display an artists name next to their album title