Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Data table for a few SQL questions : Use the following tables for your answers: PET_OWNER (OwnerID, OwnerLastName, OwnerFirstName, OwnerPhone, OwnerEmail) PET_3 (PetID, PetName, PetType,

Data table for a few SQL questions :

Use the following tables for your answers:

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

PET_3 (PetID, PetName, PetType, PetBreed, PetDOB, PetWeight, OwnerID)

BREED (BreedName, MinWeight, MaxWeight, AverageLifeExpectancy)

OwnerID in PET_3 must exist in OwnerID in OWNER.

PetBreed in PET_3 must exist in BreedName in BREED.

Sample data for these tables are shown below. For each SQL statement you write, show the results based on these data.

PET_OWNER Data

OwnerID

OwnerLastName

OwnerFirstName

OwnerPhone

OwnerEmail

1

Downs

Marsha

555-537-8765

marsha@sw.com

2

James

Richard

555-537-7654

richard@sw.com

3

Frier

Liz

555-537-6543

liz@sw.com

4

Trent

Miles

miles@sw.com

PET_3 Data

PetID

PetName

PetType

PetBreed

PetDOB

PetWeight

OwnerID

1

King

Dog

Std. Poodle

27-Feb-11

25.5

1

2

Teddy

Cat

Cashmier

01-Feb-12

10.5

2

3

Fido

Dog

Std. Poodle

17-Jul-10

28.5

1

4

AJ

Dog

Collie Mix

05-May-11

20.0

3

5

Cedro

Cat

Unknown

06-Jun-09

9.5

2

6

Woolley

Cat

Unknown

9.5

2

7

Buster

Dog

Border Collie

11-Dec-08

25.0

4

BREED Data

BreedName

MinWeight

MaxWeight

AverageLifeExpectancy

Border Collie

15.0

22.5

20

Cashmier

10.0

15.0

12

Collie Mix

17.5

25.0

18

Std. Poodle

22.5

30.0

18

Unknown

Question 1: Write an SQL statement to display the OwnerLastName, OwnerFirstName, and OwnerEmail of any owner of a pet that has an AverageLifeExpectancy value greater than 15. Use a join.

Question 2: Write an SQL statement to display the OwnerLastName, OwnerFirstName, PetName, PetType, PetBreed, and AverageLifeExpectancy for pets with a known PetBreed. Use a join.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions