wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

AIT 524 SQL Chapter 8

Total questions: 104

Worksheet time: 51mins

Name
Class
Date
1.
Retrieving only certain rows from a table is known as projection.​
a)
true
b)
false
2.
Retrieving only specific rows from a table is a process known as selection.​
a)
true
b)
false
3.
Although Oracle12c is not case sensitive in regards to keywords, table names, and column names, it is case sensitive when comparing search conditions to the data contained in a database table.
a)
true
b)
false
4.
Search conditions for data contained in non-numeric columns must be enclosed in double quotation marks.
a)
true
b)
false
5.
The BETWEEN...AND comparison operator can be used to specify a range of values as a search condition.
a)
true
b)
false
6.
Search conditions for data contained in numeric columns must be enclosed in single quotation marks.
a)
true
b)
false
7.
The IN comparison operator is used when searching for a pattern of characters.​
a)
true
b)
false
8.
The percent sign (%) and asterisk (*) symbols can be used with the LIKE comparison operator to create a search pattern.
a)
true
b)
false
9.
The percent sign (%) and underscore (_) symbols can be used with the LIKE comparison operator to create a search pattern.
a)
true
b)
false
10.
The percent sign (%) is used in a search pattern to indicate "exactly one character in this position".​
a)
true
b)
false
11.
The underscore symbol (_) is used in a search pattern to indicate "exactly one character in this position".​
a)
true
b)
false
12.
When two conditions are joined by the AND logical operator, only one of the conditions must be TRUE to be included in the query results.​
a)
true
b)
false
13.
When two conditions are joined by the AND logical operator, both of the conditions must be evaluated as FALSE to be included in the query results.
a)
true
b)
false
14.
When two conditions are joined by the AND logical operator, both of the conditions must be evaluated as TRUE to be included in the query results.​
a)
true
b)
false
15.
NOT, ALL, and OR are all considered logical operators.​
a)
true
b)
false
16.
Comparison operators are used to combine search conditions.
a)
true
b)
false
17.
Using the OR logical operator to combine search conditions based upon the same column is the same as using the IN comparison operator.​
a)
true
b)
false
18.
In a WHERE clause, logical operators are evaluated before comparison operators.​
a)
true
b)
false
19.
Logical operators are evaluated in the order of NOT, AND, and OR.​
a)
true
b)
false
20.
A NULL value is the same as a blank space.​
a)
true
b)
false
21.
To find rows containing a NULL value in a specified column, you must use the search condition of = NULL.
a)
true
b)
false
22.
The SORT BY clause is used to present query results in a specific order.​
a)
true
b)
false
23.
By default, query results are sorted in ascending order based upon the column specified in the ORDER BY clause.​
a)
true
b)
false
24.
When sorted in descending order, NULL values will be listed first in the results, unless the user specifies otherwise.​
a)
true
b)
false
25.
A column alias that has been defined in the SELECT clause of a SELECT statement cannot be referenced in an ORDER BY clause.​
a)
true
b)
false
26.
Including the keywords NULLS FIRST in the ORDER BY clause will result in NULL values appearing first in the results, regardless of the specified sort sequence.​
a)
true
b)
false
27.
The maximum number of columns that can be used to sort the results of a query is 52.​
a)
true
b)
false
28.
An ORDER BY clause can reference a column to be used for sorting based upon its position in the database table.​
a)
true
b)
false
29.
An ORDER BY clause can reference a column to be used for sorting based upon its position in the SELECT clause.​
a)
true
b)
false
30.
The first column listed in an ORDER BY clause is considered the primary sort.​
a)
true
b)
false
31.
The process of specifying that certain rows be displayed in the results of a query is known as selection.
a)
true
b)
false
32.
A search condition can be specified in a(n) SELECT clause.
a)
true
b)
false
33.
A(n) clause identifies what must exist or a requirement that must be met for a record to be included in the results of a query.
a)
true
b)
false
34.
Oracle12c is case sensitive when comparing data to a search condition.
a)
true
b)
false
35.
If a numeric column is being used for comparison against the search condition, the search condition is enclosed in single quotation marks.
a)
true
b)
false
36.
If a date column is being used for comparison against the search condition, the search condition is enclosed in double quotation marks.
a)
true
b)
false
37.
A greater than or equal to comparison is indicated by the symbols =>.
a)
true
b)
false
38.
The LIKE operator is used to indicate a range of values.
a)
true
b)
false
39.
The <>, !=, or ^= operators can be used to search for values that are not equivalent to the specified search condition
a)
true
b)
false
40.
The IN logical operator is similar to using OR.
a)
true
b)
false
41.
When two conditions are joined by the OR keyword, both conditions must be TRUE for a record to be included in the results.
a)
true
b)
false
42.
When two conditions are joined by the AND keyword, both conditions must be FALSE for a record to be included in the results.
a)
true
b)
false
43.
The < symbol is used to search for records containing a value that is less than or equal to the stated search condition.
a)
true
b)
false
44.
The BETWEEN operator is used to determine the rows that match a value in a given list.
a)
true
b)
false
45.
When using a search pattern, a(n) ? symbol is used to indicate exactly one character in that position.
a)
true
b)
false
46.
A(n) percent sign is used in a search pattern to indicate zero, one, or more characters in a position.
a)
true
b)
false
47.
NOT, AND, and OR are comparison operators.
a)
true
b)
false
48.
The "equal to" comparison operator is used to search for NULL values.
a)
true
b)
false
49.
The SORT BY clause is used for displaying the results of a query in a sorted order.
a)
true
b)
false
50.
When data is sorted in ascending order, NULL values appear first in the list.
a)
true
b)
false
51.
When sorting data, the values will be sorted in ascending order by default.
a)
true
b)
false
52.
To indicate that data should be sorted in descending order, use the DESC keyword.
a)
true
b)
false
53.
The maximum number of columns that can be used to sort data is 25.
a)
true
b)
false
54.
The numeric order of columns in a SELECT clause can be referenced in the ORDER BY clause.
a)
true
b)
false
55.
The process of retrieving only certain rows based upon a specified condition is known as ____.​
a)
selection
b)
projection
c)
retrieval
d)
derivation
56.
Which of the following clauses is used to restrict the rows returned by a query?​
a)
selection
b)
FROM
c)
WHERE
d)
ORDER BY
57.
If a user performs a query that restricts the rows returned based upon a specified date, the date must be enclosed in ____.​
a)
​double quotation marks (" ")
b)
​single quotation marks (' ')
c)
​parentheses ( )
d)
none apply
58.
A(n) ____ is used to indicate how data should relate to a given search condition.​
a)
comparison operator
b)
logical operator
c)
search pattern
d)
criteria
59.
Which of the following is NOT a comparison operator?​
a)
​>=
b)
BETWEEN…AND
c)
=
d)
NOT
60.
Which of the following operators would be most appropriate to determine whether or not the retail price of a book is at least $24.00?​
a)
LIKE
b)
BETWEEN
c)
>
d)
>=
61.
Which of the following operators is used when the criteria is based upon a search pattern?​
a)
AND
b)
LIKE
c)
IS NULL
d)
BETWEEN…AND
62.
Which of the following operators can be used to retrieve rows containing NULL values in a specific column?​
a)
=
b)
LIKE
c)
NOT
d)
none apply
63.
​Which of the following is not a valid comparison operator?
a)
=>
b)
<>
c)
^=
d)
none apply
64.
Which of the following is a valid comparison operator?​
a)
!=
b)
IN
c)
^=
d)
all apply
65.
Which of the following symbols is a wildcard character that can represent any number of characters in a WHERE clause?​
a)
​asterisk (*)
b)
​underscore (_)
c)
​question mark (?)
d)
​percent sign (%)
66.
Which of the following search patterns could be used to find the word HELLO in Oracle12c?​
a)
%H%
b)
HEL*
c)
_EL*
d)
%HEL?O
67.
Which of the following search patterns would find dates occurring only in the year 2003?​
a)
%03%
b)
*03
c)
%03
d)
_03%
68.
Which of the following is a valid logical operator?​
a)
NOT
b)
AND
c)
OR
d)
all apply
69.
Which of the following operators can be used to combine search conditions?​
a)
AND
b)
=
c)
IS NOT NULL
d)
none apply
70.
When the WHERE clause contains multiple types of operators, which of the following is resolved first?​
a)
​arithmetic operations
b)
​comparison operators
c)
​logical operators
d)
​union operators
71.
​When the WHERE clause contains multiple types of operators, which of the following is resolved last?
a)
arithmetic operations
b)
comparison operations
c)
logical operators
d)
search patterns
72.
Which of the following search conditions can be used to identify records that do not have data stored in a column named ColB?​
a)
​ColB = NULL
b)
​ColB IS NOT NULL
c)
​ColB IS NULL
d)
​ColB = ' '
73.
Which of the following search conditions can be used to identify records that have data stored in a column named ColB?​
a)
​ColB IS NOT NULL
b)
​ColB ^= NULL
c)
ColB != NULL
d)
all apply
74.
​Which of the following clauses is used to indicate a particular sort sequence for presenting query results?
a)
SELECT
b)
SORT BY
c)
WHERE
d)
ORDER BY
75.
When sorting the results in ascending order, which of the following values will be presented last in the output?​
a)
character
b)
numeric
c)
NULL
d)
date
76.
When sorting the results in ascending order, which of the following values will be presented last in the output?​
a)
numeric
b)
character
c)
NULL
d)
date
77.
When sorting the results in descending order, which of the following values will be presented first in the output?​
a)
numeric
b)
character
c)
NULL
d)
date
78.
When sorting the results in descending order, which of the following values will be presented last in the output?​
a)
numeric
b)
character
c)
NULL
d)
date
79.
To instruct Oracle12c to sort data in descending order, enter ____ after the column name in the WHERE clause.​
a)
D
b)
DES
c)
DESC
d)
none apply
80.
​To instruct Oracle12c to sort data in ascending order, enter ____ after the column name in the ORDER BY clause.
a)
a. ASC
b)
b. AND
c)
c. ASCENDING
d)
either a or c
81.
The order in which NULL values appear in the results can be overridden by which of the following keywords?​
a)
a. NULLS FIRST
b)
b. NULLS LAST
c)
c. NSEQ
d)
both a and b
82.
If there is an exact match between the data used for a primary sort, a(n) ____ can be used to determine the sequence used to display the data.​
a)
secondary sort
b)
alternative sort
c)
alternate sort
d)
supplemental sort
83.
The maximum number of columns that can be specified for sorting data is ____.​
a)
25
b)
52
c)
225
d)
255
84.
In regards to sorting, if a DISTINCT option is used in the SELECT clause of a query then ____.​
a)
​an ORDER BY clause can not be added
b)
​only columns in the SELECT clause can be used for sorting
c)
​only a primary sort is allowed
d)
none apply
85.

​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)

a. ​SELECT * FROM books WHERE pubid LIKE "1";

b)

b. ​SELECT * FROM books WHERE pubid = 1;

c)

c. ​SELECT * FROM books WHERE pubid > 1;

d)

both a and b

86.

Based upon the contents of the BOOKS table in the accompanying figure, which of the following queries will retrieve all books published in 2001?​

a)

​SELECT * FROM books

WHERE pubdate BETWEEN '01-JAN-01' AND '31-DEC-01';

b)

​SELECT * FROM books

WHERE pubdate LIKE '%01';

c)

​SELECT * FROM books

WHERE pubdate >= '01-JAN-01' AND pubdate <= '31-DEC-01';

d)

all apply

87.

​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?

a)

​​SELECT title FROM books

WHERE category = 'BUSINESS' OR 'COMPUTER' AND retail >35;

b)

​SELECT title FROM books

WHERE category = 'BUSINESS' OR category ='COMPUTER' AND retail >35;

c)

​SELECT title FROM books

WHERE (category = 'BUSINESS' OR category ='COMPUTER' ) AND retail >35;

d)

​SELECT title FROM books

WHERE category = 'BUSINESS' OR category ='COMPUTER' AND (retail >35);

88.

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?​

a)

​​SELECT * FROM books

WHERE cost > $25.00;

b)

SELECT * FROM books

WHERE cost >= 25.00;

c)

SELECT * FROM books

WHERE cost >= $25.00;

d)

none apply

89.

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?​

a)

​​SELECT * FROM books

WHERE profit > .6;

b)

SELECT * FROM books

WHERE (retail-cost)/cost > .60;

c)

SELECT * FROM books

WHERE (retail-cost)/cost > 60%;

d)

SELECT * FROM books

WHERE (retail-cost)/cost > '60';

90.

​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)

​​a. ​SELECT * FROM books

WHERE pubid = 1 OR pubid = 2 OR retail >= 42;

b)

b. SELECT * FROM books

WHERE pubid IN (1, 2) OR retail => 42;

c)

c. SELECT * FROM books

WHERE pubid = 1 AND pubid=2 OR retail >=42;

d)

both a and b

91.

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?​

a)

SELECT title, retail FROM books

ORDERED BY title;

b)

SELECT title, retail FROM books

SORTED BY title;

c)

SELECT title, retail FROM books

ORDER BY title;

d)

SELECT title, retail FROM books

SORT BY title;

92.

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?​

a)

SELECT * FROM books WHERE retail >38 SORT BY retail;

b)

SELECT * FROM books WHERE retail >38 SORTED BY retail;

c)

SELECT * FROM books WHERE retail >38 ORDERED BY retail;

d)

SELECT * FROM books WHERE retail >38 ORDER BY retail;

93.

. 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?​

a)

SELECT title, retail FROM books

ORDER BY category, retail;

b)

SELECT title, retail FROM books

ORDERED BY category, retail;

c)

SELECT title, retail FROM books

SORT BY category, retail;

d)

none apply

94.

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?

a)

SELECT category, title FROM books

ORDERED BY 1, 2 DESC;

b)

SELECT category, title FROM books

ORDER BY 1 ASC, 2 DESC;

c)

SELECT category, title FROM books

SORTED BY 1 ASC, 2 DESC;

d)

SELECT category, title FROM books

SORT BY 1, 2 DESC;

95.

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?​

a)

SELECT * FROM orders WHERE shipdate = NULL;

b)

SELECT * FROM orders WHERE shipdate > NULL;

c)

SELECT * FROM orders WHERE shipdate LIKE 'NULL';

d)

none apply

96.

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)?

a)

​SELECT order#, shipdate-orderdate FROM orders WHERE order# = 1007;

b)

​SELECT order#, shipdate-orderdate FROM orders WHERE order# LIKE 1_7%;

c)

​SELECT order#, shipdate-orderdate FROM orders WHERE order# = 1_7%;

d)

​SELECT order#, shipdate-orderdate FROM orders WHERE order# LIKE '1_7%';

97.

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?​

a)

​SELECT * FROM orders WHERE shipdate = 'NOT NULL';

b)

​SELECT * FROM orders WHERE shipdate = NOT NULL;

c)

​SELECT * FROM orders WHERE shipdate IS NULL;

d)

​SELECT * FROM orders WHERE shipdate IS NOT NULL;

98.

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?​

a)

​SELECT * FROM orders WHERE customer# = 1020 OR shipdate = NULL;

b)

​SELECT * FROM orders WHERE customer# = 1020 AND shipdate IS NULL;

c)

​SELECT * FROM orders WHERE customer# = 1020 OR shipdate IS NULL;

d)

​SELECT * FROM orders WHERE customer# = 1020 AND shipdate = NULL;

99.

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?​

a)

​SELECT * FROM orders WHERE shipcity = 'ATLANTA' OR shipcity = 'SEATTLE';

b)

​SELECT * FROM orders WHERE shipcity IN ( 'ATLANTA' , 'SEATTLE');

c)

​SELECT * FROM orders WHERE shipcity = 'Atlanta' OR shipcity = 'Seattle';

d)

​SELECT * FROM orders WHERE shipcity LIKE 'AT%' OR shipcity LIKE 'SEA%';

100.

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?​

a)

​SELECT * FROM orders WHERE shipdate-orderdate => 3;

b)

​SELECT * FROM orders WHERE shipdate-orderdate >= 3;

c)

​SELECT * FROM orders WHERE NOT shipdate-orderdate => 3;

d)

​SELECT * FROM orders WHERE NOT shipdate-orderdate >= 3;

101.

​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?

a)

​SELECT * FROM orders WHERE shipdate-orderdate => 3;

b)

​SELECT * FROM orders WHERE shipdate-orderdate >= 3;

c)

​SELECT * FROM orders WHERE NOT shipdate-orderdate =< 3;

d)

​SELECT * FROM orders WHERE NOT shipdate-orderdate <= 3;

102.

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)

​a. SELECT * FROM orders

WHERE shipdate <= '04-APR-03' AND shipdate >= '05-APR-03';

b)

​b. SELECT * FROM orders

WHERE shipdate BETWEEN '04-APR-03' AND '05-APR-03';

c)

c. ​SELECT * FROM orders

WHERE shipdate >= ‘04-APR-03’ AND shipdate <= ‘05-APR-03’;

d)

​d. both b and c

103.

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#?​

a)

SELECT * FROM orders

WHERE shipdate IS NOT NULL

ORDER BY customer#, order#;

b)

SELECT * FROM orders

WHERE shipdate IS NULL

ORDER BY customer#, order#;

c)

SELECT * FROM orders

WHERE shipdate IS NOT NULL

ORDERED BY customer#, order#;

d)

SELECT * FROM orders

WHERE shipdate IS NOT NULL

SORTED BY customer#, order#;

104.

Which of the following queries will display all orders placed in the month of March?​

a)

​SELECT * FROM orders WHERE orderdate LIKE '%Mar%';

b)

​SELECT * FROM orders WHERE orderdate LIKE '_Mar_';

c)

​SELECT * FROM orders WHERE orderdate LIKE "%Mar%";

d)

none apply