Final Review Flashcards
To display the name of each customer and the title of each book purchased by the customers would require how many join conditions?
4
3
2
1
3
Which of the following keywords can be used to join two tables that do not contain a commonly named and defined column?
NATURAL JOIN
JOIN…ON
JOIN…USING
none of the above
JOIN…ON
Which SQL statement will return the same results as the following SQL statement?
SELECT * FROM orders, customers;
SELECT * FROM orders CROSS JOIN customers;
SELECT * FROM orders, customers
WHERE orders.customer# = customers.customer#;
SELECT * FROM orders, customers
WHERE orders.customer# > customers.customer#;
SELECT * FROM o orders , c customers
WHERE o.customer# = c.customer#;
SELECT * FROM orders CROSS JOIN customers;
In Oracle11g, tables can be linked through which clause(s)?
SELECT
FROM
WHERE
both b and c
both b and c
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?
SELECT title FROM promotion
WHERE retail BETWEEN minretail AND maxretail;
SELECT title FROM promotion NATURAL JOIN books
WHERE retail BETWEEN minretail AND maxretail;
SELECT title FROM promotion JOIN books
USING retail BETWEEN minretail AND maxretail;
none of the above
none of the above
A(n) ____ is used to combine the results of two queries.
concatenation operator
set operator
comparison operator
logical operator
set operator
Which of the following SQL statements will list the name of each customer stored in the CUSTOMERS table, and, if the customer has placed an order that is contained in the ORDERS table, the order# of any order each customer has placed?
SELECT lastname, firstname, order#
FROM customers NATURAL JOIN orders
WHERE orders.customer# IS NOT NULL;
SELECT lastname, firstname, order#
FROM customers, orders
WHERE orders.customer# (+) = customers.customer#;
SELECT lastname, firstname, order#
FROM customers, orders
WHERE orders.customer# = customers.customer# (+);
SELECT lastname, firstname, order#
FROM customers NATURAL JOIN orders
WHERE orders.customer# IS NULL;
SELECT lastname, firstname, order#
FROM customers, orders
WHERE orders.customer# (+) = customers.customer#;
Which of the following SQL statements will display the title of the books ordered by customer# 1003?
SELECT title
FROM customers NATURAL JOIN books
WHERE customer# = 1003;
SELECT title
FROM customers JOIN orders USING (customer#)
JOIN orderitems USING (order#) JOIN books USING (isbn)
WHERE customer# = 1003;
SELECT title
FROM customers JOIN orders ON (customer#)
JOIN orderitems ON (order#) JOIN books ON (isbn)
WHERE customer# = 1003;
both a and b
SELECT title
FROM customers JOIN orders USING (customer#)
JOIN orderitems USING (order#) JOIN books USING (isbn)
WHERE customer# = 1003;
Which of the following set operators can be used to make certain that only the rows returned by both queries are displayed in the results?
UNION
UNION ALL
INTERSECT
MINUS
INTERSECT
Which of the following set operators will display the results of the combined SQL statements without suppressing duplicate rows?
UNION
UNION ALL
INTERSECT
MINUS
UNION ALL
Which of the following SQL statements will display books that have not been ordered recently?
SELECT title
FROM books, orderitems
WHERE books.isbn orderitems.isbn;
SELECT title
FROM books NATURAL JOIN orderitems
WHERE JOIN IS NULL;
SELECT title FROM books NATURAL JOIN orderitems
MINUS
SELECT title FROM books;
SELECT title FROM books
MINUS
SELECT title FROM books NATURAL JOIN orderitems;
SELECT title FROM books
MINUS
SELECT title FROM books NATURAL JOIN orderitems;
Which of the following SQL statements will return the names of all customers who placed an order on April 12, 2003?
SELECT lastname, firstname
FROM customers
WHERE orderdate = ‘12-APR-03’;
SELECT lastname, firstname
FROM customers NATURAL JOIN orders
WHERE orderdate = ‘12-APR-03’;
SELECT lastname, firstname
FROM customers JOIN orders ON (customer#)
WHERE orderdate = ‘12-APR-03’;
both a and b
SELECT lastname, firstname
FROM customers NATURAL JOIN orders
WHERE orderdate = ‘12-APR-03’;
Which of the following queries will display the first and last name of the individual who referred another customer, along with the customer# of the referred customer?
SELECT r.firstname, r.lastname, c.customer#
FROM customers r, customers c
WHERE r.customer# = c.referred;
SELECT r.firstname, r.lastname, c.customer#
FROM customers r JOIN customers c
ON r.customer# = c.referred;
SELECT r.firstname, r.lastname, c.customer#
FROM customers r NATURAL JOIN customers c;
both a and b
both a and b
Which of the following keywords is used to create a Cartesian join?
OUTER JOIN
CROSS JOIN
NATURAL JOIN
JOIN…USING
CROSS JOIN
Which of the following can only be used to link tables that have a common column?
FULL OUTER JOIN
JOIN…ON
NATURAL JOIN
CROSS JOIN
NATURAL JOIN
Which of the following will display the title, publication date, and publisher name of each book in the BUSINESS category?
SELECT title, pubdate, name
FROM publisher JOIN books USING (pubid)
WHERE category = ‘BUSINESS’;
SELECT title, pubdate, name
FROM publisher JOIN books ON (pubid)
WHERE category = ‘BUSINESS’;
SELECT title, pubdate, name
FROM publisher OUTER JOIN books USING (pubid)
WHERE category = ‘BUSINESS’;
SELECT title, pubdate, name
FROM publisher CROSS JOIN books USING (pubid)
WHERE category = ‘BUSINESS’;
SELECT title, pubdate, name
FROM publisher JOIN books USING (pubid)
WHERE category = ‘BUSINESS’;
Which of the following is an example of assigning “o” as a table alias for the ORDERS table in the FROM clause?
FROM o orders, c customers
FROM o.orders, c.customers
FROM orders o, customers c
FROM orders.o, customers.c
FROM orders o, customers c
Which of the following queries will display data from both the ORDERS and CUSTOMERS tables?
SELECT * FROM orders, customers;
SELECT lastname, firstname, order#
FROM orders NATURAL JOIN customers;
SELECT lastname, firstname, order#
FROM orders, customers
WHERE orders.customer# = customers.customer#;
all of the above
all of the above