21.16. Mixed-Up Code Questions

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

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!

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.

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.

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.

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.

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.

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.

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.

You have attempted of activities on this page