Problem

Use the following tables for your answers to questions 3.7 through 3.51: PET_OWNER (Own...

Use the following tables for your answers to questions 3.7 through 3.51:

PET_OWNER (OwnerID, OwnerLastName, OwnerFirstName, OwnerPhone, OwnerEmail)

PET (PetID, PetName, PetType, PetBreed, PetDOB, OwnerID)

Sample data for these tables are shown in Figures 3-18 and 3-19. For each SQL statement you write, show the results based on these data.

If possible, run the statements you write for the questions that follow in an actual DBMS, as appropriate, to obtain results. Use data types that are consistent with the DBMS you are using. If you are not using an actual DBMS, consistently represent data types by using either the SQL Server, Oracle Database, or MySQL data types shown in Figure 3-5.

The following table schema for the BREED table shows a new table to be added to the pet database:

BREED (BreedName, MinWeight, MaxWeight, AverageLifeExpectancy)

Assume that Breed in PET_3 is a foreign key that matches the primary key BreedName in BREED and that BreedName in BREED is now a foreign key linking the two tables with the referential integrity constraint:

BreedName in PET_3 must exist in BreedName in BREED

If needed, you may also assume that a similar referential integrity constraint exists between PET and BREED and between PET_2 and BREED. The BREED table data are shown in Figure 3-21.

Write SQL statements to (1) create the BREED table, (2) insert the data in Figure 3-21 into the BREED table, (3) alter the PET_3 table so that PetBreed is a foreign key referencing BreedName in BREED, and (4) with the BREED table added to the pet database, write an SQL statement to display the last name, first name, and email of any owner of a pet that has an AverageLifeExpectancy value greater than 15. Use a subquery.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search