Here is my work for Exercise 10.
This exercise is a continuation of Exercise 9. We use a subquery to generate a table and then use UPDATE to change rows related to the subquery. In the code, we first create a temporary table of pet ids of all pets owned by Zed. We then set all their names to “Zed’s Pet” using UPDATE/SET/WHERE IN.
Extra Credit
- Write an SQL that only renames dead pets I own to “Zed’s Dead Pet”.
- Go to the SQL As Understood By SQLite page and start reading through the docs for CREATE TABLE, DROP TABLE, INSERT,DELETE, SELECT, and UPDATE.
- Try out some of the interesting things you find in these docs, and take notes on things you don’t understand so you can research them more later.
Things I don’t understand: CREATE INDEX, CREATE TRIGGER, CREATE VIEW, CREATE VIRTUAL TABLE, DETACH DATABASE, INDEXED BY, DROP TRIGGER, DROP INDEX, DROP VIEW, VACUUM, RELEASE SAVEPOINT.
Many of the commands are related in concepts (For example, what is a savepoint? –> Release savepoint, savepoint.)