Font size
WorksheetsAIT 524 SQL Chapter 8
Total questions: 104
Worksheet time: 51mins
Based upon the contents of the BOOKS table in the accompanying figure, which of the following SQL statements will retrieve all books published by the publisher assigned Pubid 1?
a. SELECT * FROM books WHERE pubid LIKE "1";
b. SELECT * FROM books WHERE pubid = 1;
c. SELECT * FROM books WHERE pubid > 1;
both a and b
Based upon the contents of the BOOKS table in the accompanying figure, which of the following queries will retrieve all books published in 2001?
SELECT * FROM books
WHERE pubdate BETWEEN '01-JAN-01' AND '31-DEC-01';
SELECT * FROM books
WHERE pubdate LIKE '%01';
SELECT * FROM books
WHERE pubdate >= '01-JAN-01' AND pubdate <= '31-DEC-01';
all apply
Based upon the contents of the BOOKS table in the accompanying figure, which of the following queries will retrieve all book titles that are in the Business or Computer category and have a retail price of more than $35.00?
SELECT title FROM books
WHERE category = 'BUSINESS' OR 'COMPUTER' AND retail >35;
SELECT title FROM books
WHERE category = 'BUSINESS' OR category ='COMPUTER' AND retail >35;
SELECT title FROM books
WHERE (category = 'BUSINESS' OR category ='COMPUTER' ) AND retail >35;
SELECT title FROM books
WHERE category = 'BUSINESS' OR category ='COMPUTER' AND (retail >35);
Based upon the contents of the BOOKS table in the accompanying figure, which of the following queries will return all books that cost at least $25.00?
SELECT * FROM books
WHERE cost > $25.00;
SELECT * FROM books
WHERE cost >= 25.00;
SELECT * FROM books
WHERE cost >= $25.00;
none apply
Based upon the contents of the BOOKS table in the accompanying figure, which of the following queries will display all books stored in the BOOKS table that generate more than 60 percent profit?
SELECT * FROM books
WHERE profit > .6;
SELECT * FROM books
WHERE (retail-cost)/cost > .60;
SELECT * FROM books
WHERE (retail-cost)/cost > 60%;
SELECT * FROM books
WHERE (retail-cost)/cost > '60';
Based upon the contents of the BOOKS table in the accompanying figure, which of the following queries will retrieve all books stored in the BOOKS table with Pubid 1 or 2 or that have a retail price of at least $42.00?
a. SELECT * FROM books
WHERE pubid = 1 OR pubid = 2 OR retail >= 42;
b. SELECT * FROM books
WHERE pubid IN (1, 2) OR retail => 42;
c. SELECT * FROM books
WHERE pubid = 1 AND pubid=2 OR retail >=42;
both a and b
Based upon the contents of the BOOKS table in the accompanying figure, which of the following queries will list the title and retail price of each book stored in the BOOKS table, sorted in order of the book titles?
SELECT title, retail FROM books
ORDERED BY title;
SELECT title, retail FROM books
SORTED BY title;
SELECT title, retail FROM books
ORDER BY title;
SELECT title, retail FROM books
SORT BY title;
Based upon the contents of the BOOKS table in the accompanying figure, which of the following queries will list all books stored in the BOOKS table with a retail price of more than $38 sorted by retail price?
SELECT * FROM books WHERE retail >38 SORT BY retail;
SELECT * FROM books WHERE retail >38 SORTED BY retail;
SELECT * FROM books WHERE retail >38 ORDERED BY retail;
SELECT * FROM books WHERE retail >38 ORDER BY retail;
. Based upon the contents of the BOOKS table in the accompanying figure, which of the following queries will display the title and retail price of each book stored in the BOOKS table in order of category and retail price?
SELECT title, retail FROM books
ORDER BY category, retail;
SELECT title, retail FROM books
ORDERED BY category, retail;
SELECT title, retail FROM books
SORT BY category, retail;
none apply
Based upon the contents of the BOOKS table in the accompanying figure, which of the following queries will return the category and title of all books stored in the BOOKS table presented in order of their category and, for the books in the same category, sort the title of the books in descending order?
SELECT category, title FROM books
ORDERED BY 1, 2 DESC;
SELECT category, title FROM books
ORDER BY 1 ASC, 2 DESC;
SELECT category, title FROM books
SORTED BY 1 ASC, 2 DESC;
SELECT category, title FROM books
SORT BY 1, 2 DESC;
Based upon the contents of the ORDERS table in the accompanying figure, which of the following SELECT statements will retrieve all orders contained in the ORDERS table that have not yet been shipped to the customer?
SELECT * FROM orders WHERE shipdate = NULL;
SELECT * FROM orders WHERE shipdate > NULL;
SELECT * FROM orders WHERE shipdate LIKE 'NULL';
none apply
Based upon the contents of the ORDERS table in the accompanying figure, which of the following SQL statements will display how long it took to ship order # 1007 (based upon when the order was originally placed)?
SELECT order#, shipdate-orderdate FROM orders WHERE order# = 1007;
SELECT order#, shipdate-orderdate FROM orders WHERE order# LIKE 1_7%;
SELECT order#, shipdate-orderdate FROM orders WHERE order# = 1_7%;
SELECT order#, shipdate-orderdate FROM orders WHERE order# LIKE '1_7%';
Based upon the contents of the ORDERS table in the accompanying figure, which of the following SQL statements will display all orders contained in the ORDERS table that have been shipped to the customer?
SELECT * FROM orders WHERE shipdate = 'NOT NULL';
SELECT * FROM orders WHERE shipdate = NOT NULL;
SELECT * FROM orders WHERE shipdate IS NULL;
SELECT * FROM orders WHERE shipdate IS NOT NULL;
Based upon the contents of the ORDERS table in the accompanying figure, which of the following SQL statements will list all orders placed by customer # 1020 that have not yet been shipped?
SELECT * FROM orders WHERE customer# = 1020 OR shipdate = NULL;
SELECT * FROM orders WHERE customer# = 1020 AND shipdate IS NULL;
SELECT * FROM orders WHERE customer# = 1020 OR shipdate IS NULL;
SELECT * FROM orders WHERE customer# = 1020 AND shipdate = NULL;
Based upon the contents of the ORDERS table in the accompanying figure, which of the following queries will not list the orders that have been shipped to Atlanta or Seattle?
SELECT * FROM orders WHERE shipcity = 'ATLANTA' OR shipcity = 'SEATTLE';
SELECT * FROM orders WHERE shipcity IN ( 'ATLANTA' , 'SEATTLE');
SELECT * FROM orders WHERE shipcity = 'Atlanta' OR shipcity = 'Seattle';
SELECT * FROM orders WHERE shipcity LIKE 'AT%' OR shipcity LIKE 'SEA%';
Based upon the contents of the ORDERS table in the accompanying figure, which of the following queries will display all orders that were not shipped for at least three days after the order was received?
SELECT * FROM orders WHERE shipdate-orderdate => 3;
SELECT * FROM orders WHERE shipdate-orderdate >= 3;
SELECT * FROM orders WHERE NOT shipdate-orderdate => 3;
SELECT * FROM orders WHERE NOT shipdate-orderdate >= 3;
Based upon the contents of the ORDERS table in the accompanying figure, which of the following queries will return all orders shipped within three days after the order was received?
SELECT * FROM orders WHERE shipdate-orderdate => 3;
SELECT * FROM orders WHERE shipdate-orderdate >= 3;
SELECT * FROM orders WHERE NOT shipdate-orderdate =< 3;
SELECT * FROM orders WHERE NOT shipdate-orderdate <= 3;
Based upon the contents of the ORDERS table in the accompanying figure, which of the following queries will display all orders shipped between April 4, 2003 and April 5, 2003?
a. SELECT * FROM orders
WHERE shipdate <= '04-APR-03' AND shipdate >= '05-APR-03';
b. SELECT * FROM orders
WHERE shipdate BETWEEN '04-APR-03' AND '05-APR-03';
c. SELECT * FROM orders
WHERE shipdate >= ‘04-APR-03’ AND shipdate <= ‘05-APR-03’;
d. both b and c
Based upon the contents of the ORDERS table in the accompanying figure, which of the following queries will list all orders contained in the ORDERS table that have been shipped based upon the customer# and order#?
SELECT * FROM orders
WHERE shipdate IS NOT NULL
ORDER BY customer#, order#;
SELECT * FROM orders
WHERE shipdate IS NULL
ORDER BY customer#, order#;
SELECT * FROM orders
WHERE shipdate IS NOT NULL
ORDERED BY customer#, order#;
SELECT * FROM orders
WHERE shipdate IS NOT NULL
SORTED BY customer#, order#;
Which of the following queries will display all orders placed in the month of March?
SELECT * FROM orders WHERE orderdate LIKE '%Mar%';
SELECT * FROM orders WHERE orderdate LIKE '_Mar_';
SELECT * FROM orders WHERE orderdate LIKE "%Mar%";
none apply
