Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the following tables (with partial data shown) for a car rental database to answer questions 20-25: SEE QUESTIONS BELOW. CUSTOMER CID CNAME AGE RESID_CITY

Use the following tables (with partial data shown) for a car rental database to answer questions 20-25: SEE QUESTIONS BELOW.

CUSTOMER

CID

CNAME

AGE

RESID_CITY

BIRTHPLACE

10

BLACK

40

ERIE

TAMPA

20

GREEN

25

CARY

ERIE

30

JONES

30

HEMET

TAMPA

40

MARTIN

35

HEMET

TAMPA

50

SIMON

22

ERIE

ERIE

60

VERNON

60

CARY

CARY

In table CUSTOMER, CID is the primary key (Customer ID).

RENTALS

CID

MAKE

DATE_OUT

PICKUP

RETURN

RTN

10

FORD

10-OCT-1994

CARY

CARY

1

10

GM

01-NOV-1995

TAMPA

CARY

2

10

FORD

01-JAN-1995

ERIE

ERIE

3

20

NISSAN

07-JUL-1994

TAMPA

TAMPA

4

30

FORD

01-JUL-1995

CARY

ERIE

5

30

GM

01-AUG-1995

ERIE

ERIE

6

40

FORD

01-AUG-1994

CARY

ERIE

7

50

GM

01-SEP-1995

ERIE

CARY

8

70

TOYOTA

02-SEP-1995

RENO

RENO

9

In the table RENTALS, RTN provides the rental number (the primary key), CID is the customer's unique id, PICKUP is the city where the car was picked up, and Return is the city where the car was returned.

RENTCOST

MAKE

COST

FORD

30

GM

40

NISSAN

30

TOYOTA

20

VOLVO

50

RENTCOST shows the base cost of renting a given MAKE for one day.

CITYADJ

CITY

FACTOR

CARY

1

ERIE

1.1

RENO

0.9

TAMPA

0.8

If the return city of table RENTALS is the one listed in table CITYADJ, the cost of the rental is multiplied by FACTOR and by DAYS shown in table RENTLENGTH below.

RENTLENGTH

RTN

DAYS

1

1

2

3

3

2

4

2

5

4

6

2

7

3

8

1

RENTLENGTH shows the number of days for the rental number (RTN) shown in table RENTALS. In a database used in reality, this table would be merged with the RENTALS table.

20. SELECT DISTINCT CID, CNAME FROM CUSTOMER WHERE CID IN (SELECT CID FROM RENTALS WHERE MAKE IN ('FORD', 'TOYOTA')) The CNAMEs shown by the execution of this query are: A. BLACK B. BLACK, JONES C. BLACK, JONES, MARTIN D. BLACK, JONES, MARTIN, VERNON

21. SELECT DISTINCT CUSTOMER.CID, CNAME FROM CUSTOMER, RENTALS, RENTCOST WHERE CUSTOMER.CID = RENTALS.CID AND RENTALS.MAKE = RENTCOST.MAKE AND NOT EXISTS (SELECT * FROM RENTALS R, RENTCOST C WHERE R.MAKE = C.MAKE AND RENTALS.CID = R.CID AND RENTCOST.COST <> C.COST) The meaning of this query is: A. List all customers with more than one car make rented B. List all customers with one or more rentals for which the cost of each car make rented is the same C. List all customers who have only rented one make D. None of the above

22. SELECT MAKE FROM RENTALS, CUSTOMER WHERE RENTALS.CID = CUSTOMER.CID AND RESID_CITY = 'HEMET' GROUP BY MAKE HAVING COUNT (DISTINCT RENTALS.CID) = (SELECT COUNT(*) FROM CUSTOMER WHERE RESID_CITY = 'HEMET') The execution of this query produces the following number of rows: A. 0 B. 1 C. 2 D. 3

23. SELECT MAKE FROM RENTALS, CUSTOMER WHERE RENTALS.CID = CUSTOMER.CID AND RESID_CITY = 'HEMET' GROUP BY MAKE HAVING COUNT (DISTINCT RENTALS.CID) = (SELECT COUNT(*) FROM CUSTOMER WHERE RESID_CITY = 'HEMET') The meaning of this query is the following: A. List all makes of cars rented to customers residing in Hemet B. List all makes of cars rented to at least one customer residing in Hemet C. List all makes of cars rented to all customers residing in Hemet D. None of the above

24. SELECT CID, CNAME FROM CUSTOMER WHERE 0 = (SELECT COUNT(*) FROM RENTALS WHERE CUSTOMER.CID = RENTALS.CID) What is the interpretation of this query? A. List the customers who do not have rentals B. List the customers who have one rental C. List the customers who have 0 or more rentals D. List the customers who have 1 or more rentals

25. SELECT CNAME, DATE_OUT, RTN FROM CUSTOMER, RENTALS WHERE CUSTOMER.CID = RENTALS.CID AND BIRTHPLACE IN ('ERIE', 'CARY') AND EXISTS (SELECT * FROM RENTCOST WHERE COST < 40 AND RENTALS.MAKE= RENTCOST.MAKE) The CNAMEs shown by the execution of this query are: A. SIMON B. GREEN, BLACK, SIMON C. GREEN

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago