This exercise requires you to have access to Oracle Express (or a similar SQL da
ID: 3707505 • Letter: T
Question
This exercise requires you to have access to Oracle Express (or a similar SQL database).
The Prince William County Humane Center wants a database for storing information on their pets.
1.)Create the table(s) needed to store pet information. At a minimum, the table(s) should capture the following information on the pets (20 points)
-Name of pet
-Type of pet (dog, cat …etc.)
-Breed (dachshund, beagle, terrier …etc)
-Gender
-Date in
-Date out
2.)Write the SQL statement(s) to insert records for a minimum of 40 sample pets (20 points)
3.)Write the SQL statement(s) to obtain the following information (60 points)
-List of all pets
-List of all types of pets
-List of all breeds of dogs
-Least popular breed of cat
NOTE: Provide all your work as a single SQL file, with comments embedded. There must not be any errors in the SQL file in order to obtain full credit.
Explanation / Answer
1) create table pet(name varchar2(20), type varchar2(10), breed varchar2(10), gender varchar2(10), Datein date(), Dateout date() );
2) insert into pet values( '&name', '&type', '&breed', '&gender', '&Datein', '&Dateou');
3) select name from pet;
select distinct type from pet;
select distinct breed from pet where type='dog';
select breed, count(breed) as lessPopular from pet group by breed having type = 'cat' order by lessPopular limit 1;
// query 1 creates table named pet with fields name, type, breed, gender, datein and dateout.
// using 2 query you can insert as many records as you want
// query 3 selects all pets, types, breeds and least popular breed of cat from table from pet.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.