Font size
WorksheetsAIT 524 SQL Chapter 11
Total questions: 109
Worksheet time: 45mins
Which of the following is a valid SQL statement?
SELECT SUM(quantity*retail) "Total Sales"
FROM orders JOIN orderitems ON orders.order# = orderitems.order# JOIN books ON orderitems ON orderitems.ISBN = books.ISBN WHERE orderdate = '02-APR-03';
SELECT SUM(quantity*retail) "Total Sales"
FROM orders JOIN orderitems ON orders.order# = orderitems.order# JOIN books ON orderitems ON orderitems.ISBN = books.ISBN HAVING orderdate = '02-APR-03';
SELECT customer#, SUM(quantity*retail) "Total Sales"
FROM orders JOIN orderitems ON orders.order# = orderitems.order# JOIN books ON orderitems ON orderitems.ISBN = books.ISBN HAVING orderdate = '02-APR-03';
SELECT customer#, SUM(quantity*retail) "Total Sales"
FROM orders JOIN orderitems ON orders.order# = orderitems.order# JOIN books ON orderitems ON orderitems.ISBN = books.ISBN HAVING orderdate = '02-APR-03' GROUP BY customer#;
Based upon the contents of the BOOKS tables, which of the following SQL statements will return the number of different publishers represented in the table?
SELECT COUNT(DISTINCT pubid) FROM books;
SELECT DISTINCT COUNT(pubid) FROM books;
SELECT DISTINCT (COUNT(pubid)) FROM books;
SELECT (DISTINCT COUNT(pubid)) FROM books;
Based on the contents of the BOOKS table, which of the following is a valid SQL statement?
SELECT pubid, AVERAGE(retail-cost) "Average Profit"
FROM books;
SELECT pubid, AVERAGE(retail-cost) "Average Profit"
FROM books
GROUP BY pubid;
SELECT pubid, AVG(retail-cost) "Average Profit"
FROM books
GROUP BY pubid;
SELECT pubid, AVG(retail-cost) "Average Profit"
FROM books
HAVING retail-cost > 25;
Based on the contents of the BOOKS table, which of the following SQL statements will return the total profit generated by books provided by publisher 4?
SELECT TOTAL(retail-cost) FROM books
WHERE pubid = 4;
SELECT TOTAL(retail-cost) FROM books
GROUP BY pubid;
SELECT SUM(retail-cost) FROM books
WHERE pubid = 4;
SELECT SUM(retail-cost) FROM books
GROUP BY pubid = 4;
Based upon the contents of the BOOKS table, which of the following will determine the number of books provided by publisher 3?
SELECT SUM(isbn)
FROM books
WHERE pubid = 3;
SELECT TOTAL(*)
FROM books
WHERE pubid = 3;
SELECT COUNT(pubid)
FROM books
WHERE pubid = 3;
none apply
Based upon the contents of the BOOKS table, which of the following will display the retail price of the most expensive book provided by publisher 3?
SELECT MAX(retail)
FROM books
GROUP BY pubid;
SELECT MAXIMUM(retail)
FROM books
WHERE pubid = 3;
SELECT MAX(retail)
FROM books
WHERE pubid = 3;
SELECT MAXIMUM(retail)
FROM books
HAVING pubid = 3;
Based on the contents of the BOOKS table, which of the following will display the date of the book with the earliest publication date?
SELECT MIN(pubdate)
FROM books;
SELECT title
FROM books
WHERE pubdate = MIN(pubdate);
SELECT title
FROM books
WHERE pubdate = MINIMUM(pubdate);
SELECT MINIMUM(pubdate)
FROM books;
Which of the following can be used with character data?
MIN
MAX
COUNT
all apply
Which of the following can be used with date columns?
MIN
MAX
COUNT
all apply
Based on the contents of the ORDERS table, which of the following SQL statements will display the number of orders that have not been shipped?
SELECT order#, COUNT(shipdate)
FROM orders
WHERE shipdate IS NULL;
SELECT order#, COUNT(shipdate)
FROM orders
WHERE shipdate IS NULL
GROUP BY order#;
SELECT COUNT(shipdate)
FROM orders
WHERE shipdate IS NULL;
SELECT COUNT(*)
FROM orders
WHERE shipdate IS NULL;
Based on the contents of the ORDERS table, which of the following SELECT statements will determine the number of orders placed by each customer?
SELECT COUNT(DISTINCT(customer#))
FROM orders;
SELECT COUNT(*)
FROM orders;
SELECT customer#, COUNT(customer#)
FROM orders
GROUP BY customer#;
none apply
Based upon the contents of the ORDERS table, which of the following will display how many orders were shipped to each state?
SELECT shipstate,COUNT(*)
FROM orders;
SELECT shipstate,COUNT(customer#)
FROM orders;
SELECT shipstate,COUNT(*)
FROM orders
HAVING COUNT(*) >0
SELECT shipstate,COUNT(*)
FROM orders
GROUP BY shipstate;
Which of the following is not a GROUP BY extension?
ROLLUP
CUBE
OLAP
all apply
What clause offers many options to identify measures and patterns to analyze in a query?
ANALYZE
MATCH_RECOGNIZE
PATTERN_MATCH
MATCH_TREND
