Question: Problem 1 here: https://www.chegg.com/homework-help/questions-and-answers/database-systems-sql-problem-1-matrix-manipulations-optimal-use-sql-matrix-operations-impl-q23843783 Database Systems, SQL Problem 2: The Pets Database There is another way to import data into mysql. When you start mysql,
Problem 1 here: https://www.chegg.com/homework-help/questions-and-answers/database-systems-sql-problem-1-matrix-manipulations-optimal-use-sql-matrix-operations-impl-q23843783
Database Systems, SQL
Problem 2: The Pets Database
There is another way to import data into mysql. When you start mysql, you should use the -enable-local-infile option:
sudo mysql -enable-local-infile u root
This allows you to import individual tables into a database. Create a new database called pets.
a)Create two tables:
Pet(name:VARCHAR(20),owner:VARCHAR(20),
species:VARCHAR(20),sex:CHAR(1),birth:DATE,death:DATE)
and
Event(name:VARCHAR(20),date:DATE,type:VARCHAR(15),
remark:VARCHAR(255))
b)Load data into these tables using the two file provided , Pet Table Data and Pet Events Table Data. You can use the following command syntax example for Pet Table Data:
mysql> LOAD DATA LOCAL INFILE Pet Table Data.txt INTO TABLE pet FIELDS TERMINATED BY ,;
c)Write a SQL query against this database. Wed like to see all the male cats and all the female dogs.
d)Write a SQL query that provides the age of each pet that has had a litter.
Pet Table Data
Fluffy,Harold,cat,f,1993-02-04,\N, Claws,Gwen,cat,m,1994-03-17,\N, Buffy,Harold,dog,f,1989-05-13,\N, Fang,Benny,dog,m,1990-08-27,\N, Bowser,Diane,dog,m,1979-08-31,1995-07-29, Chirpy,Gwen,bird,f,1998-09-11,\N, Whistler,Gwen,bird,\N,1997-12-09,\N, Slim,Benny,snake,m,1996-04-29,\N,
Pet Events Table Data
Fluffy,1995-05-15,litter,4 kittens 3 female 1 male, Buffy,1993-06-23,litter,5 puppies 2 female 3 male, Buffy,1994-06-19,litter,3 puppies 3 female Chirpy,1999-03-21,vet,needed beak straightened, Slim,1997-08-03,vet,broken rib, Bowser,1991-10-12,kennel,, Fang,1991-10-12,kennel,, Fang,1998-08-28,birthday,Gave him a new chew toy, Claws,1998-03-17,birthday,Gave him a new flea collar, Whistler,1998-12-09,birthday,First birthday,
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
