a height between 10 and 15 inches and a weight between 5 and 10 pounds? (Hint: you should
use the BETWEEN command)
26. [SQL Week 1 Question 100-026) Your publisher has decided to reclassify all Knights from Real to
Magical with regard to their Realm. Make this update in your database. Before you do this
update, you should be able to verify you have 100 creatures with Realm of Magical. After this
update, how many creatures have a Magical Realm?
If you get an error code 1175 that grumbles that you are using safe update mode, run the
following code before your update:
SET SQL_SAFE_UPDATES = 0;
Note- this command has you modify the database. If you are then going to go back and answer
some other questions after you do this command, be sure you refresh your database (i.e, re-
load and re-run the script which made the database in the first place) before answering those
questions.
27. [SQL Week 1 Question 100-027] DELETE. It's time to delete stuff.
Note - this command has you modify the database. If you are going to go back and answer
some other questions after you do this command, be sure you refresh your database (i.e. re-
load and re-run the script which made the database in the first place) before answering those
questions.
First, let's verify your database is fully refreshed. Run the following checksum code. (There's a
lot of code here; it's best to copy/paste into SQL.)
SELECT ((COUNT(*) * AVG(Weight)) MOD 99) as checksum from litcharacters:
You should get a checksum answer of 47.
Delete all the dinosaurs who have already made an appearance. In other words, delete anything
with a Creature SubType of Dinosaur and more than 0 appearances.
Run the checksum code again. What is your checksum now?
28. [SQL Week 1 Question 100-028] Note - this command has you modify the database. If you are
going to go back and answer some other questions after you do this command, be sure you
refresh your database (i.e. re-load and re-run the script which made the database in the first
place) before answering those questions.
First, check your database is fully refreshed. Run the following checksum code. (There's a lot of
code here; it's best to copy/paste into SQL.)
SELECT (COUNT(*) * AVG(Weight)) MOD 99) as checksum from litcharacters:
You should get a checksum answer of 47.
You have some more characters to include. Insert the below characters in to the database:
('Mogwai', 'Magical', 'Other', 'Fairy', 'Female', '25', "158","2"),
('Menehune', "Real", "Human", "Superhero', "Male", "56", "195', '5')