Question: Need some help with SQL problems. posted database and excercises. 1 CREATE DATABASE IF NOT EXISTS menagerie; 2 use menagerie; 4drop the pet table if
Need some help with SQL problems. posted database and excercises.


1 CREATE DATABASE IF NOT EXISTS menagerie; 2 use menagerie; 4drop the pet table if it exists, then recreate it DROP TABLE IF EXISTS pet; 8 CREATE TABLE pet 10 name VARCHAR (20) PRIMARY KEY, owner VARCHAR (20)., species VARCHAR (20), sex CHAR(1) DEFAULT "f", birth DATE, death DATE 12 13 15 16 ; 17 18 INSERT INTO pet VALUES ("Fluffy", "Harold", "cat", "f", "2010-02-04", 19 INSERT INTO pet VALUES ("Claws", "Gwen", 20 INSERT INTO pet VALUES ("Buffy", "Harold", 21 INSERT INTO pet VALUES ("Fang", 22 INSERT INTO pet VALUES ("Bowser", 23 INSERT INTO pet VALUES ("Chirpy", 24 INSERT INTO pet VALUES ("lhistler", 25 INSERT INTO pet VALUES ("Slim", 26 INSERT INTO pet VALUES ('Puffball, 'Diane', 'hamster', 'f, 2016-03-30 ,NULL) 27 28drop the event table if it exists, then recreate it 29 null); "cat" "m" 2011-03-17", null); "dog" "f" 2006-05-13", null); "Benny "Diane", "Gwen" "Gwen" "Benny "dog" "m","2007-08-27",null); "1996-08-3", 2012-07-29"); "bird", "f""2015-09-11", null); "bird", null, "2014-12-09" null); "snake","m","2013-04-29",null); DROP TABLE IF EXISTS event; 31 32 CREATE TABLE event 4 name VARCHAR(20), 35 36 type VARCHAR (15), 37 date DATE remark VARCHAR(255), CONSTRAINT PRIMARY KEY (name, date) 39; 40 41 INSERT INTO event VALUES ("Fluffy" 42 INSERT INTO event VALUES ("Buffy", 43 INSERT INTO event VALUES ("Buffy", "2012-05-15", "litter", "2010-06-23", "litter", "2011-06-19", "litter", 4 kittens, 3 female, 1 male") "5 puppies, 2 female, 3 male"); "3 puppies, 3 female" INSERT INTO event VALUES ("Chirpy", 2016-03-21", "vet", "needed beak straightened"); 45 INSERT INTO event VALUES ("Slim", 46 INSERT INTO event VALUES ("Bowser", 47 INSERT INTO event VALUES ("Fang" 48 INSERT INTO event VALUES ("Fang" 49 INSERT INTO event VALUES ("Claws", 50 INSERT INTO event VALUES ("Whistler", 2015-12-09", "birthday", "2014-08-03","vet" "broken rib"); "2008-10-12","kennel", null); "2008-10-12", "kennel", null); "2015-08-28", "birthday","Gave him a new chew toy" "Gave him a new flea collar"); First birthday") 2015-03-17","birthday
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
