download the Chinook sample database
Sign up for Pythonanywhere.com

Normally when you use Python you use in locally on your computer, but we are going to cheat are going to use a website calledpythonanywhere.com.

We are going to use this because:

  • It’s free!
  • It’s easy!
  • It’s web based so you code from home, school or even on the beach :-)

So if you haven’t done already, head over to Pythonanywhere.com and sign up for a free account!

pa-signup1 pa-signup2

 

Create an /sql/chinook folder

pa-files

A. Create a folder called sql

B. Create a folder inside that folder called chinook

pa-challenges

 

Upload the chinook db

pa-upload

Load up SQLite

pa-bash

pa-chinook

Ready to rock!
pa-sqlreadytorock


List tables in a database

.table

This command finds out what tables the database contains

Challenge 1
Find out what tables the database contains.

List columns in a table

PRAGMA table_info(table_name);

Challenge 2

Find out what column names and types the Album table contains

 

 

List all rows in a table

SELECT * FROM table_name;

Challenge 3

Find out what artists are in the Artist table.

Select specific column names in a table

SELECT column_name, another_columnn_name FROM table_name;

Challenge 4

Create a query that lists the first name and last name of all customers in the Customer table.

Filter rows in a table with equals

SELECT * FROM table_name WHERE column_name = “search_criteria“;

Challenge 5

Create a query that selects all rows in the Employee table where the Title is ‘Sales Support Agent’

Filter rows in a table with comparison operators

SELECT * FROM table_name WHERE column_name > search_criteria;

Challenge 6

Create a query that lists all rows in the PlaylistTrack table where the TrackId is greater than 3000.

Homework:

Finish challenges 1 to 6