Site MapHelpFeedbackMultiple Choice Quiz
Multiple Choice Quiz
(See related pages)



1

Reference: 9-1

CUSTOMER
<a onClick="window.open('/olcweb/cgi/pluginpop.cgi?it=jpg::::/sites/dl/free/0072942207/90831/9_1A.jpg','popWin', 'width=NaN,height=NaN,resizable,scrollbars');" href="#"><img valign="absmiddle" height="16" width="16" border="0" src="/olcweb/styles/shared/linkicons/image.gif"> (22.0K)</a>

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

RENTALS
<a onClick="window.open('/olcweb/cgi/pluginpop.cgi?it=jpg::::/sites/dl/free/0072942207/90831/9_1B.jpg','popWin', 'width=NaN,height=NaN,resizable,scrollbars');" href="#"><img valign="absmiddle" height="16" width="16" border="0" src="/olcweb/styles/shared/linkicons/image.gif"> (27.0K)</a>

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
<a onClick="window.open('/olcweb/cgi/pluginpop.cgi?it=jpg::::/sites/dl/free/0072942207/90831/9_1C.jpg','popWin', 'width=NaN,height=NaN,resizable,scrollbars');" href="#"><img valign="absmiddle" height="16" width="16" border="0" src="/olcweb/styles/shared/linkicons/image.gif"> (12.0K)</a>

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

CITYADJ
<a onClick="window.open('/olcweb/cgi/pluginpop.cgi?it=jpg::::/sites/dl/free/0072942207/90831/9_1D.jpg','popWin', 'width=NaN,height=NaN,resizable,scrollbars');" href="#"><img valign="absmiddle" height="16" width="16" border="0" src="/olcweb/styles/shared/linkicons/image.gif"> (10.0K)</a>

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
<a onClick="window.open('/olcweb/cgi/pluginpop.cgi?it=jpg::::/sites/dl/free/0072942207/90831/9_1E.jpg','popWin', 'width=NaN,height=NaN,resizable,scrollbars');" href="#"><img valign="absmiddle" height="16" width="16" border="0" src="/olcweb/styles/shared/linkicons/image.gif"> (12.0K)</a>

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.

(ACCESS)
       SELECT CNAME, MAKE, RTN
       FROM CUSTOMER RIGHT JOIN RENTALS ON CUSTOMER.CID = RENTALS.CID
       WHERE RENTALS.CID > 20

The distinct values appearing in the column CNAME of the result of this query are:
A)JONES, MARTIN, SIMON, VERNON
B)JONES, MARTIN, SIMON
C)JONES, MARTIN, SIMON, null value
D)JONES, MARTIN, SIMON, TOYOTA
2

(ORACLE)
       SELECT CNAME, MAKE, RENTLENGTH.RTN
       FROM CUSTOMER, RENTALS, RENTLENGTH
       WHERE CUSTOMER.CID = RENTALS.CID (+)
       AND RENTALS.RTN = RENTLENGTH.RTN
       AND CUSTOMER.CID > 20

The distinct values appearing in the column RTN of the result of this query are:
A)5, 6, 7, 8
B)5, 6, 7, 8, 9
C)5, 6, 7, 8, null
D)None of the above
3

SELECT DISTINCT CID, CNAME
       FROM CUSTOMER
       WHERE MAKE IN
       (SELECT MAKE FROM RENTALS WHERE RETURN = 'ERIE')

The CNAMEs shown by the execution of this query are:
A)BLACK
B)BLACK, JONES
C)BLACK, JONES, MARTIN
D)An error occurs
4

SELECT DISTINCT CID, CNAME
       FROM CUSTOMER
       WHERE CID IN
       (SELECT CID FROM RENTALS WHERE RETURN IN
       (SELECT BIRTHPLACE FROM CUSTOMER))

The number of distinct CNAMEs shown by the execution of this query is:
A)6
B)5
C)4
D)3
5

(ORACLE) DELETE FROM CUSTOMER
       WHERE CID IN
       (SELECT CID FROM RENTALS
       WHERE DATE_OUT > '31-DEC-1994')

The execution of this query deletes the following number of rows from the table CUSTOMER:
A)0
B)1 or 2
C)3 or 4
D)5 or 6
6

SELECT CID, CNAME FROM CUSTOMER
       WHERE EXISTS
       (SELECT CID FROM RENTALS
       WHERE CUSTOMER.CID = RENTALS.CID
       AND PICKUP = 'CARY')

The nested subquery will be processed the following number of times:
A)3
B)4
C)5
D)6
7

SELECT CID, CNAME FROM CUSTOMER
       WHERE 0 =
       (SELECT COUNT(*) FROM RENTALS
       WHERE CUSTOMER.CID = RENTALS.CID)

The execution of this query produces the following number of rows:
A)0
B)1
C)2
D)3
8

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 execution of this query lists the following CNAMEs:
A)None
B)BLACK, GREEN, JONES, MARTIN, SIMON
C)BLACK, JONES
D)GREEN, MARTIN, SIMON
9

SELECT CID FROM RENTALS
       GROUP BY CID
       HAVING COUNT (DISTINCT MAKE) = (SELECT COUNT(*) FROM RENTCOST)

The execution of this query produces the following number of rows:
A)0
B)1 or 2
C)3 or 4
D)5
10

SELECT CID FROM RENTALS
       GROUP BY CID
       HAVING COUNT (DISTINCT MAKE) = (SELECT COUNT(*) FROM RENTCOST)

The meaning of this query is the following:
A)List the CID of all customers with one or more rentals in which the cost of each car make rented is the same
B)List the CID of all customers who rent at least one car listed in RENTCOST
C)List the CID of all customers renting the same number of cars
D)List the CID of all customers who rent all cars listed in RENTCOST







Mannino DB Design 3eOnline Learning Center with Powerweb

Home > Chapter 9 > Multiple Choice Quiz