CIST 1220 - Chapter 4 Quiz
Which of the following operators can be used for a column computation?
+
You form compound conditions by connecting two or more simple conditions using _____.
AND, OR, and NOT operators
Which operator is inclusive, meaning that a query selects a value equal to either value in the condition along with those in the range of the values?
BETWEEN
Which function determines the number of rows in a table?
COUNT
In MySQL, you can use an asterisk (*) to represent any column when using the _____.
COUNT function
All SELECT statements require a WHERE clause.
False
The GROUP BY clause sorts the data in a particular order.
False
The only arithmetic operators that can be used in SELECT statements are + for addition and - for subtraction.
False
Which clause lets you group data on a particular column?
GROUP BY
Bradford would like to write a query that returns the average unit sales over the last 30 days for each of his bakery's product types: cupcakes, muffins, and cookies. There are several flavors of each in the table, but the product types are identified in a CATEGORY column as "Cupcake," "Muffin," or "Cookie." What should the last part of his query be, following the part shown below?
GROUP BY CATEGORY;
Which clause is used to restrict the groups that will be included in a query result?
HAVING
Mallory would like to display the rows from a MySQL table that have "Red," "Pink," or "White" in the COLOR column. A concise way of writing her query would be to use a(n) _____.
IN clause
Which operator finds rows that do not contain a null value in the specified column?
IS NOT NULL
When you need to find rows with null values in a MySQL table, you can use the _____.
IS NULL operator
Which operator uses one or more wildcard characters to test for a pattern match?
LIKE
Preceding a condition with which SQL operator reverses the truth of the original condition?
NOT
What clause can you use to list data in a specific order?
ORDER BY
Which MySQL clause used with the query SELECT* FROM PACKAGE would be the most likely to yield the following results?
ORDER BY PRICE DESC, PACKAGE_NAME
What SQL command do you use to query a database?
SELECT
The basic form of the SQL SELECT command is _____.
SELECT-FROM-WHERE
Which function calculates a total of the values in a column?
SUM
It is possible to place one query inside another.
True
It is possible to use both a WHERE clause and a HAVING clause in a SELECT statement.
True
What is the appropriate sequence for the elements in a SQL query clause that displays the rows returned in a particular order?
command, major sort key followed by operator (if any), minor sort key followed by operator (if any)
Adding a ORDER BY UNIT_PRICE clause to a SQL query will _____.
display the results in ascending order by UNIT_PRICE
What does the following SQL query do? SELECT INVOICE_NUM FROM INVOICE_LINE WHERE PROD_CODE IN (SELECT PROD_CODE FROM PRODUCTS WHERE (PROD_TYPE = 'Cupcake'));
lists the invoice numbers for invoices containing line items with a "Cupcake" product type
When you need to sort data on two columns, the less important column is called the _____.
minor sort key
When a SQL query is written so as to display the results in a specific order, this order is determined by the _____.
sort key
In the SELECT clause, you can indicate that you want to include all columns using the _____.
symbol
When a subquery is used in a SQL statement _____.
the subquery is evaluated first