yammik / intro-to-sql-starter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Intro to SQL

  1. Install the SQLite Browser if you haven't already here
  2. Open the SQLite Browser and click 'File -> Open DataBase'
  3. 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)
  4. 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

Challenges

  1. Write the SQL to return all of the rows in the artists table?
  1. Write the SQL to select the artist with the name "Black Sabbath"
  1. 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
  1. Write the SQL to alter the fans table to have a artist_id column type integer?
  1. Write the SQL to add yourself as a fan of the Black Eyed Peas? ArtistId 169
 
  1. Check out the Faker gem. gem install faker, open up irb, run require 'faker' and then generate a fake name for yourself using Faker::Name.name. How would you update your name in the fans table to be your new name?

  2. Write the SQL to return fans that are not fans of the black eyed peas.

  1. Write the SQL to display an artists name next to their album title
  1. Write the SQL to display artist name, album name and number of tracks on that album
  1. Write the SQL to return the name of all of the artists in the 'Pop' Genre

BONUS (very hard)

  1. I want to return the names of the artists and their number of rock tracks who play Rock music and have move than 30 tracks in order of the number of rock tracks that they have from greatest to least

About


Languages

Language:Ruby 100.0%