Skip to main content

Section 21.16 Mixed-Up Code Questions

Checkpoint 21.16.1.

Create a database file “music.sqlite” and a table “Tracks” with two columns.

Checkpoint 21.16.2.

Create a database file “music.sqlite”. Then, insert 2 tracks into the table, commit that change, print the track data, delete a track if it meets a certain condition, and commit that change. Remember to make a connection to the database and create the cursor, first!

Checkpoint 21.16.3.

Create a database file “spider.sqlite”. Then selects all of the rows in the table “Twitter”. Then loop through the rows and prints out each row. At the end it will print the total count of rows, before closing the cursor.

Checkpoint 21.16.4.

Create a database ‘pets.sqlite' with a table ‘Dogs'. Insert 2 dogs into the table, commit that change, print them, then delete a dog if it meets a certain condition, and commit that change.

Checkpoint 21.16.5.

Create a ‘clothes.sqlite' database and select all of the rows in the table “Socks”. Then, loop through the rows, print out each row and print out the total number of rows. Then, delete all green socks from the table.

Checkpoint 21.16.6.

Create a lunch database. Select row ‘Size' in the table “Tacos” in descending order by ‘Price', then get and print out the total number of rows.

Checkpoint 21.16.7.

Create a database “pets.sqlite”. Join tables ‘Dogs' and ‘Cats', then select all rows on column ‘name' for both tables, where the name is ‘Spot'. At the end it will print the total count of rows, before closing the cursor.

Checkpoint 21.16.8.

Crreate a database “clothes.sqlite”. Simply open the database and join tables pants and shirts and select all pants and shirts with the same fabric, then print them.

Checkpoint 21.16.9.

Create a database ‘desserts.sqlite'. Simply open the database and select all of the Cupcakes and Cakes where the Cupcake icing and Cake frosting are chocolate. Then, print the rows.