Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create SQL queries to do the following: Display the last name and phone number o

ID: 667079 • Letter: C

Question

Create SQL queries to do the following:

Display the last name and phone number of all dog owners. Use a subquery to do this.

Display the first and last name of owners and the type of animal of all unknown breeds.

Display the pet name and owner last name of all dogs.

Save all 3 queries.

Export the PET table to an Excel spreadsheet. Create a Pivot table. Have the cost display as currency. Take screen shots* of two different views without a report filter and paste the screen shots into a Word document. Then add a report filter and choose one value for it, take a screen shot, then choose a different value for the same filter and take another screen shot. Paste those into the Word document containing the first two screen shots. You should now have 4 screen shots in this Word document. Save the Word document as Screen shots. Save the pivot table as Pivot.

Below is the Tables I made and need to use for the above work.

PETID PetName PetType PetBreed PetCost OwnerID 1 King Dog Std. Poodle 1000 1 2 Teddy Cat Cashmere 850 2 3 Fido Dog Std. Poodle 1000 1 4 Aj Dog Collie Mix 550 3 5 Cedro Cat Unknown 600 2 6 Wooly Cat Unknown 600 2 7 Buster Dog Border Collie 800 4

Explanation / Answer


ALTER TABLE PET ADD CONSTRAINT pet_fk foreign key(OwnerID) REFERENCES PET_OWNER(OwnerID);

Above query will create a referential integrity constraint on OwnerId in PET. Here, I assume that the tables are already made and as deletions should not cascade, I have not added any action on deletion. So, by default the PET records would not be allowed to be deleted as it is the child table.