Chapter 3: How to retrieve data from a single table

COMPLETION

1.The ______clause of the SELECT statement names the table that contains the data to be retrieved.

2.If you want to filter the result set that’s returned by a SELECT statement, you must include a/an ______clause.

3.To return all of the columns from the base table, you can code the ______operator in the SELECT clause.

4.Unless you assign a/an ______, the column name in the result set is the same as the column name in the base table.

5.To concatenate character strings, you use the ______operator in a string expression.

6.To override the order of precedence in an arithmetic expression, you can use ______.

7.To prevent duplicate rows from being returned by a SELECT statement, you can code the ______keyword in the SELECT clause.

8.To retrieve rows in which an expression matches a string pattern called a mask, you can use the ______keyword followed by the mask.

9.To sort the records that are retrieved by a SELECT statement in descending sequence by invoice_total, you code ______after ORDER BY invoice_total.

10.To test expressions that use literal values, arithmetic operators, and functions, you can use the ______table that is automatically available.

MULTIPLE CHOICE

1.When you code a SELECT statement, you must code the four main clauses in the following order

a. / SELECT, FROM, ORDER BY, WHERE / c. / SELECT, WHERE, ORDER BY, FROM
b. / SELECT, ORDER BY, FROM, WHERE / d. / SELECT, FROM, WHERE, ORDER BY

2.Which of the following isn’t a valid column alias?

a. / total / c. / total_sales
b. / total sales / d. / "Total Sales"

3.Which of the following expressions will not compute 10% of the balance due if balance due is the invoice total minus the credit total minus the payment total?

a. / invoice_total - credit_total - payment_total / 10
b. / (invoice_total - payment_total - credit_total) / 10
c. / (invoice_total - (payment_total + credit_total)) * 0.10
d. / ((invoice_total - payment_total) - credit_total) / 10

4.Which of the following WHERE clauses will return a maximum of five rows?

a. / WHERE ROWNUM = 5
b. / WHERE ROWNUM <= 5
c. / WHERE ROWNUMBER = 5
d. / WHERE ROWNUMBER <= 5

5.When coded in a WHERE clause, which of the following search conditions will not return a result set that includes all invoices with an invoice_total value of $1000 or less?

a. / invoice_total <= 1000 / c. / invoice_total IN (0,1000)
b. / NOT (invoice_total > 1000) / d. / invoice_total BETWEEN 0 AND 1000

6.When coded in a WHERE clause, which search condition will return invoices when payment_date isn’t null and invoice_total is greater than or equal to $500?

a. / payment_date IS NULL AND invoice_total > 500
b. / payment_date IS NOT NULL OR invoice_total >= 500
c. / NOT (payment_date IS NULL AND invoice_total <= 500)
d. / payment_date IS NOT NULL AND invoice_total >= 500

7.The order of precedence for the logical operators in a WHERE clause is

a. / Not, And, Or
b. / And, Or, Not
c. / Or, And, Not
d. / Not, Or, And

8.When you code an ORDER BY clause, you can specify a

a. / column name or alias
b. / column name or expression
c. / column name, alias, or expression
d. / column name, alias, expression, or column number

9.Which of the following could be used to calculate the number of days (rounded) between the current date and the value in a future_ date column?

a. / ROUND(future_date - SYSDATE) / c. / ROUND(future_date - CURR_DATE)
b. / ROUND(SYSDATE - future_date) / d. / ROUND(CURR_DATE - future_date)

10.May 31, 2008 at 2:00 PM is

a. / before ‘31-May-2008’
b. / after ‘31-May-2008’
c. / between ‘01-May-2008’ and ‘31-May-2008’