Multiple Choice Identify the
choice that best completes the statement or answers the question.
|
|
|
 Structure of the BOOKS table  Structure of the PUBLISHER table
|
|
|
1.
|
Which of the following SQL statements will display the name of each publisher
that publishes a book classified in the COMPUTER category?
a. | SELECT UNIQUE name FROM books, publisher; | b. | SELECT UNIQUE
name FROM books NATURAL JOIN publisher WHERE category =
'COMPUTER'; | c. | SELECT DISTINCT name FROM books JOIN
publisher WHERE category = 'COMPUTER'; | d. | both b and c |
|
|
|
2.
|
Which of the following SQL statements will display the title and cost of each
book stored in the BOOKS table, as well as, the name of the contact person and the phone number to
call to reorder the book?
a. | SELECT title, cost, contact, phone FROM publisher, books; | b. | SELECT title, cost,
contact, phone FROM publisher JOIN book USING (pubid); | c. | SELECT title, cost,
contact, phone FROM publisher JOIN book USING (isbn); | d. | SELECT title, cost,
contact, phone FROM publisher JOIN book USING (contact); |
|
|
|
3.
|
Which of the following will display the title, publication date, and publisher
name of each book in the BUSINESS category?
a. | SELECT title, pubdate, name FROM publisher JOIN books USING (pubid) WHERE
category = 'BUSINESS'; | b. | SELECT title, pubdate, name FROM publisher
JOIN books ON (pubid) WHERE category = 'BUSINESS'; | c. | SELECT title,
pubdate, name FROM publisher OUTER JOIN books USING (pubid) WHERE category =
'BUSINESS'; | d. | SELECT title, pubdate, name FROM publisher
CROSS JOIN books USING (pubid) WHERE category =
'BUSINESS'; |
|
|
|
 Structure of the PROMOTION
table  Structure of the BOOKS table  Structure of the ORDERITEMS table
|
|
|
4.
|
Which of the following SQL statements will display the gift or gifts that should
be sent with order# 1003?
a. | SELECT gift FROM promotion WHERE order# = 1003; | b. | SELECT gift FROM
promotion NATURAL JOIN books WHERE order# = 1003; | c. | SELECT gift FROM promotion, orderitems oi,
books b WHERE retail BETWEEN minretail AND maxretail AND oi.isbn = b.isbn AND order# =
1003; | d. | none of the above |
|
|
|
 Contents of the PROMOTION
table  Structure of the BOOKS table
|
|
|
5.
|
Which of the following SQL statements will display the gift that should be sent
to any customer who orders the book titled SHORTEST POEMS?
a. | SELECT gift FROM promotion WHERE gift = minretail; | b. | SELECT gift FROM
promotion, books WHERE retail >= minretail AND title = 'SHORTEST
POEMS'; | c. | SELECT gift FROM promotion, books WHERE retail BETWEEN minretail AND
maxretail AND title = 'SHORTEST POEMS'; | d. | none of the
above |
|
|
|
6.
|
Which of the following SQL statements will display the gift that should be sent
to any customer who orders the book titled THE WOK WAY TO COOK?
a. | SELECT title FROM promotion WHERE retail BETWEEN minretail AND
maxretail; | b. | SELECT title FROM promotion NATURAL JOIN books WHERE retail BETWEEN minretail AND
maxretail; | c. | SELECT title FROM promotion JOIN books USING retail BETWEEN minretail AND
maxretail; | d. | none of the above |
|
|
|
 Structure of the ORDERS table  Structure of the CUSTOMERS table
|
|
|
7.
|
Which of the following SQL statements will return the names of all customers who
placed an order on April 12, 2003?
a. | SELECT lastname, firstname FROM customers WHERE orderdate =
'12-APR-03'; | b. | SELECT lastname, firstname FROM customers
NATURAL JOIN orders WHERE orderdate = '12-APR-03'; | c. | SELECT lastname,
firstname FROM customers JOIN orders ON (customer#) WHERE orderdate =
'12-APR-03'; | d. | both a and b |
|
|
|
8.
|
Which of the following queries will display data from both the ORDERS and
CUSTOMERS tables?
a. | SELECT * FROM orders, customers; | b. | SELECT lastname, firstname, order# FROM
orders NATURAL JOIN customers; | c. | SELECT lastname, firstname, order# FROM
orders, customers WHERE orders.customer# = customers.customer#; | d. | all of the
above |
|
|
|
9.
|
Which SQL statement will return the same results as the following SQL
statement? SELECT * FROM orders, customers;
a. | SELECT * FROM orders CROSS JOIN customers; | b. | SELECT * FROM
orders, customers WHERE orders.customer# = customers.customer#; | c. | SELECT * FROM
orders, customers WHERE orders.customer# > customers.customer#; | d. | SELECT * FROM o
orders , c customers WHERE o.customer# = c.customer#; |
|
|
|
10.
|
Which of the following SQL statements will display all customers who have not
recently placed an order?
a. | SELECT customer# FROM customers UNION SELECT customer# FROM
orders; | b. | SELECT customer# FROM orders MINUS SELECT customer# FROM
customers; | c. | SELECT customer# FROM orders INTERSECT SELECT customer# FROM
customers; | d. | SELECT customer# FROM customers MINUS SELECT customer# FROM
orders; |
|