You are on page 1of 66

Name _____________________________

1. SQL is the
________ standard language to access relational databases.
2. (Projection / Selection) is done by listing column names in a select lis
t of a query.
3. To remove duplications within the result set, you should use which key w
ord after the word select.
a. DISTINCT
b. UNIQUE
c. Either of the above.
d. NONE of the above.
4. Which statement(s) below would likely fail?
a. SelectT * FROM employees; (two T s in the select word)
b. SELECT * FROM employees (unless employees created with double quotes)
c. SELECT * FROM employ-
ees;
d. Select *
5. Number columns returned in queries are normally displayed (Left, Right,
Center) justified.
6. Which query(s) would return a result of 50?
a. Select (100*2+50)/5 from dual;
b. Select 100*2 +50/5 from dual;
c. Select (100)*2+(50/5) from dual;
d. Select ((100 *2)+50)/5 from dual;
7. Consider the statement:
SELECT salary + commission_pct as compensation, Commission is ||commission_pct as C
ommission FROM employees;
What is the value of the compensation and commission in the result set for a row
where the value of the salary column is 1000 and the commission_pct column is n
ull? (ignore double quotes)
a. compensation: 1000 commission: null
b. compensation: null commission: null
c. compensation: null commission: Commission is
d. compensation: 0 commission: Commission is 0
8. For a column alias to contain a space or retain case, it must (choose th
e best answer):
a. Be enclosed within the ampersand symbol.
b. Be enclosed with single quotes.
c. Be enclosed within parenthesis
d. Be enclosed with double quotes
9. A SQL query must have both a list of items following the keyword _______
__ and a data source following the keyword _____________.
10. (True / False) In the where clause of a query, the column name and value
are interchangeable on either side of the operator, therefore department_id = 9
0 or 90 = department_id is interchangeable.
11. Literal values for text or dates must be enclosed within _______________
.
12. Between 900 and 1100 would include how many integers? (199 / 200 / 201 )
(circle one)
13. A SQL condition Where manager id IN (100, 101, 201) would be equivalent t
o three compound conditions using the ( OR / AND ) operator.
14. In the LIKE operator, which symbol is used to represent a single text ch
aracter or numeric digit?
a. "_ "
b. "/"
c. "&"
d. "%"
15. Which of the following has the highest precedence? (AND , NOT, OR , all
are equal must use parenthesis
16. By default in an ORDER BY clause, where would rows with a null value app
ear? (beginning of result set, end of result set, not listed in result set)
17. To reverse the default order of a sorting operation in the ORDER BY clau
se we use which word __DESC_________.
18. A column may be sorted in an ORDER BY clause by: (circle all true answer
s)
a column name or expression in the select list.
a. a column alias in the select list.
b. a number representing the column position in the select list.
c. a column found in the data source but not in the select list.

19. Row functions return ( a value for each row in the data source, a value
for each row in the result set, always only a single value).
20. To always return capitalized text, use the function _____________.
21. The result of SELECT SUBSTR( abcdefg , 3,1) FROM dual; is
a. Abc
b. c
c. d
d. none of the above
22. The result of SELECT TRIM( x from xxAxx ) FROM dual; is
a. Axx
b. xxA
c. A
d. xAx
23. Which function(s) would result in a value of 46?
a. Select substr(46.567, 1, 2) from dual; (works because of implicit conve
rsion-not if in doubles quotes)
b. Select round( 46.567, -1) from dual;
c. Select round(46.567) from dual;
d. Select trunc(46.567) from dual;
24. To add one hour to the current time, we should use:
a. sysdate + 1
b. to_char(sysdate, HH:MI:SS )+1
c. sysdate + 1/24
d. to_char(sysdate) + 1/24
25. Which format model was used to convert 25-MAY-04 to May Twenty-Fifth, Tw
o Thousand Four?
a. TO_CHAR('25-MAY-04','DD-MON-YY'), 'Month Ddspth, Year'
b. TO_CHAR(TO_DATE('25-MAY-04','DD-MON-YY'), 'Month Dd, Year')
c. TO_DATE(TO_CHAR('25-MAY-04','Dd-Month-YYYY'), 'Month Ddspth, YYYY')
d. TO_CHAR(TO_DATE('25-MAY-04','DD-MON-YY'), 'Month Ddspth, Year')
26. In the arithmetic expression: salary*12 - 400, which operation will be e
valuated first?
27. In date formats to use Oracle s built in algorithm for determining the cen
tury digits of the year when only providing the last two digits, we should use w
hich format element? (HH, CC, RR, YY)
28. (Projection / Selection) is done by using a WHERE clause in a SQL statem
ent
29. Which of the following can be used in the SELECT statement to return all
columns of data in a table?
a. ALL
b. Columns
c. *
d. DISTINCT
30. Which of the following is the Order of Precedence for arithmetic express
ions?
a. addition, subtraction, multiplication, division
b. subtraction, multiplication, addition, division
c. division , multiplication, addition, subtraction
d. multiplication, division, addition, subtraction
31. Mr. /Ms. Steven King is an employee of our company. hich statement below
will return a list of employees in the following format?
a. SELECT 'Mr./Ms. '||first_name||' '||last_name ||' '||'is an employee of
our company.' AS "Employees"
FROM employees;
b. SELECT "Mr./Ms."||first_name||' '||last_name 'is an employee of our comp
any.' AS "Employees"
FROM employees;
c. SELECT Mr./Ms. ||first_name||' '||last_name ||' '||"is an employee of ou
r company." AS "Employees"
FROM employees;
d. SELECT 'Mr./Ms. 'first_name,last_name ||' '||'is an employee of our comp
any.'
FROM employees;
32. For a column alias to contain a space or retain the proper case, it must
:
a. Be enclosed with single quotes.
b. Be enclosed within parentheses.
c. Be enclosed with single quotes
d. Be enclosed within the ampersand symbol
33. If any column value in an arithmetic expression is null,
a. The query will create an error message.
b. The result will be zero.
c. The result is null.
d. The SQL interpreter can not process the query.
34. Which query will return three columns each with UPPER CASE column headin
gs?
a. SELECT "Department_id", "Last_name", "First_name"
FROM employees;
b. SELECT DEPARTMENT_ID, LAST_NAME, FIRST_NAME
FROM employees;
c. SELECT department_id, last_name, first_name AS UPPER CASE
FROM employees;
d. SELECT department_id, last_name, first_name
FROM employees;
35. When used in a WHERE clause, which logical condition operator will retur
n TRUE, only if both conditions are TRUE?
a. OR
b. NOT
c. AND
d. BETWEEN
36. In this database, product_id values are stored like XY01, XY02 while qua
ntity values are stored as numbers. After executing this query, which statement
below is TRUE?
SELECT quantity, product_id
FROM products
ORDER BY quantity and product_id
a. The results are sorted numerically.
b. The results are sorted first numerically then alphabetically.
c. The results are sorted first alphabetically then numerically.
d. The results are sorted alphabetically.
37. The following query will return which result?
SELECT last_name AS "Employee Name", job_id, code_number, hire_date
FROM employees
ORDER BY code_number ASC;
a. Results for the hire_date column will be displayed from smallest to larg
est date.
b. All column results will be ordered from smallest to largest value.
c. Results for the code_number column will be displayed from smallest numbe
r to largest number.
d. Only the code_number column will be returned.
38. You want to produce query results that display the last_name, first_name
, department_id and salary of all employees. Display the first_name, last_name
and department _id in ACS but for employees in the same department display the s
alary results in descending order. Also, if two employees have the same last_nam
e, you want the first names to be displayed in ascending order.
a. ORDER BY department_id, salary ASC, last_name, first_name DESC;
b. ORDER BY last_name, first_name,department_id, salary DESC
c. ORDER BY department_id, salary, last_name, first_name DESC;
d. ORDER BY department_id DESC, salary , last_name||' '||first_name ASC
39. In the following query, what will be evaluated first?
SELECT job_id, salary, hire_date
FROM employees
WHERE salary = 4000 OR job_id = 'AD_PRES' AND hire_date LIKE '03-JUN-04';
a. job_id = 'AD_PRES' AND hire_date LIKE '03-JUN-04';
b. salary = 4000 OR job_id = 'AD_PRES
c. salary = 4000
d. LIKE '03-JUN-04'
40. In the LIKE operator, which symbols can be used?
a. & and %
b. % and _
c. $ and /
d. * and _
41. The following query will return what values?
SELECT employee_id "number", salary "pay"
FROM employees
WHERE employee_id = 103 OR salary = 4000;
a. All employees plus those with employee id's of 103 whose salary is 4000.
b. Only employees with employee id's of 103 whose salary is 4000.
c. Any employee with an employee_id of 103 and also any employee whose sala
ry is 4000.
d. Employees with an employee_id equal to " number" whose salary values are
also equal to "pay".
42. What value(s) could be displayed?
SELECT prefix
FROM phone
WHERE prefix BETWEEN 360 AND 425
OR prefix IN(515, 206, 253)
AND BETWEEN 555 AND 904);
a. 625
b. 902
c. 410
d. 499
43. Which query will display of all employees whose last names start with "S
" and have an 'ae' anywhere in their last name?
a. SELECT last_name
FROM employees
WHERE last_name LIKE '_S%ae%';
b. SELECT last_name
FROM employees
WHERE last_name LIKE 'S_ae%';
c. SELECT last_name
FROM employees
WHERE last_name LIKE 'S&ae&';
d. SELECT last_name
FROM employees
WHERE last_name LIKE 'S%ae%';
44. A column may be sorted in an ORDER BY clause by: (choose all true answer
s)
a. column name or expression in the SELECT list.
b. A column alias in the SELECT list.
c. Placing the ORDER BY clause before the SELECT statement.
d. Putting a column number in the SELECT list.
45. The following query will return which result?
SELECT last_name, job_id, department_id, hire_date
FROM employees
ORDER BY 4 DESC;
a. Only column 4 will be displayed.
b. All 4 columns will be displayed in descending order.
c. 4 columns will be displayed with hire_dates displayed with the most rece
nt dates listed first.
d. The hire_date column
46. If hire_date is 13-May-04, write the format for each example below:
TRUNC(hire_date) = _____________
TRUNC(hire_date, 'MONTH') = ___________
ROUND(hire_date, 'YEAR') = ____________
47. Make "rein" out of "reindeer"? __________________
48. How do I take the "O" off of "Oracle"? ________________
49. How can I turn 'Snowman' into ****Snowman****?

Name ______________________________
1. SQL is the ________ standard language to access relational databases.
2. (Projection / Selection) is done by listing column names in a select lis
t of a query.
3. To remove duplications within the result set, you should use which key w
ord after the word select.
a. DISTINCT
b. UNIQUE
c. Either of the above.
d. NONE of the above.
4. Which statement(s) below would likely fail?
a. SelectT * FROM employees; (two T s in the select word)
b. SELECT * FROM employees (unless employees created with double quotes)
c. SELECT * FROM employ-
ees;
d. Select *
5. Number columns returned in queries are normally displayed (Left, Right,
Center) justified.
6. Which query(s) would return a result of 50?
a. Select (100*2+50)/5 from dual;
b. Select 100*2 +50/5 from dual;
c. Select (100)*2+(50/5) from dual;
d. Select ((100 *2)+50)/5 from dual;
7. Consider the statement:
SELECT salary + commission_pct as compensation, Commission is ||commission_pct as C
ommission FROM employees;
What is the value of the compensation and commission in the result set for a row
where the value of the salary column is 1000 and the commission_pct column is n
ull? (ignore double quotes)
a. compensation: 1000 commission: null
b. compensation: null commission: null
c. compensation: null commission: Commission is
d. compensation: 0 commission: Commission is 0
8. For a column alias to contain a space or retain case, it must (choose th
e best answer):
a. Be enclosed within the ampersand symbol.
b. Be enclosed with single quotes.
c. Be enclosed within parenthesis
d. Be enclosed with double quotes
9. A SQL query must have both a list of items following the keyword _______
__ and a data source following the keyword _____________.
10. (True / False) In the where clause of a query, the column name and value
are interchangeable on either side of the operator, therefore department_id = 9
0 or 90 = department_id is interchangeable.
11. Literal values for text or dates must be enclosed within _______________
.
12. Between 900 and 1100 would include how many integers? (199 / 200 / 201 )
(circle one)
13. A SQL condition Where manager id IN (100, 101, 201) would be equivalent t
o three compound conditions using the ( OR / AND ) operator.
14. In the LIKE operator, which symbol is used to represent a single text ch
aracter or numeric digit?
a. "_ "
b. "/"
c. "&"
d. "%"
15. Which of the following has the highest precedence? (AND , NOT, OR , all
are equal must use parenthesis
16. By default in an ORDER BY clause, where would rows with a null value app
ear? (beginning of result set, end of result set, not listed in result set)
17. To reverse the default order of a sorting operation in the ORDER BY clau
se we use which word __DESC_________.
18. A column may be sorted in an ORDER BY clause by: (circle all true answer
s)
a column name or expression in the select list.
a. a column alias in the select list.
b. a number representing the column position in the select list.
c. a column found in the data source but not in the select list.

19. Row functions return ( a value for each row in the data source, a value
for each row in the result set, always only a single value).
20. To always return capitalized text, use the function _____________.
21. The result of SELECT SUBSTR( abcdefg , 3,1) FROM dual; is
a. Abc
b. c
c. d
d. none of the above
22. The result of SELECT TRIM( x from xxAxx ) FROM dual; is
a. Axx
b. xxA
c. A
d. xAx
23. Which function(s) would result in a value of 46?
a. Select substr(46.567, 1, 2) from dual; (works because of implicit conve
rsion-not if in doubles quotes)
b. Select round( 46.567, -1) from dual;
c. Select round(46.567) from dual;
d. Select trunc(46.567) from dual;
24. To add one hour to the current time, we should use:
a. sysdate + 1
b. to_char(sysdate, HH:MI:SS )+1
c. sysdate + 1/24
d. to_char(sysdate) + 1/24
25. Which format model was used to convert 25-MAY-04 to May Twenty-Fifth, Tw
o Thousand Four?
a. TO_CHAR('25-MAY-04','DD-MON-YY'), 'Month Ddspth, Year'
b. TO_CHAR(TO_DATE('25-MAY-04','DD-MON-YY'), 'Month Dd, Year')
c. TO_DATE(TO_CHAR('25-MAY-04','Dd-Month-YYYY'), 'Month Ddspth, YYYY')
d. TO_CHAR(TO_DATE('25-MAY-04','DD-MON-YY'), 'Month Ddspth, Year')
26. In the arithmetic expression: salary*12 - 400, which operation will be e
valuated first?
27. In date formats to use Oracle s built in algorithm for determining the cen
tury digits of the year when only providing the last two digits, we should use w
hich format element? (HH, CC, RR, YY)
28. (Projection / Selection) is done by using a WHERE clause in a SQL statem
ent
29. Which of the following can be used in the SELECT statement to return all
columns of data in a table?
a. ALL
b. Columns
c. *
d. DISTINCT
30. Which of the following is the Order of Precedence for arithmetic express
ions?
a. addition, subtraction, multiplication, division
b. subtraction, multiplication, addition, division
c. division , multiplication, addition, subtraction
d. multiplication, division, addition, subtraction
31. Mr. /Ms. Steven King is an employee of our company. hich statement below
will return a list of employees in the following format?
a. SELECT 'Mr./Ms. '||first_name||' '||last_name ||' '||'is an employee of
our company.' AS "Employees"
FROM employees;
b. SELECT "Mr./Ms."||first_name||' '||last_name 'is an employee of our comp
any.' AS "Employees"
FROM employees;
c. SELECT Mr./Ms. ||first_name||' '||last_name ||' '||"is an employee of ou
r company." AS "Employees"
FROM employees;
d. SELECT 'Mr./Ms. 'first_name,last_name ||' '||'is an employee of our comp
any.'
FROM employees;
32. For a column alias to contain a space or retain the proper case, it must
:
a. Be enclosed with single quotes.
b. Be enclosed within parentheses.
c. Be enclosed with single quotes
d. Be enclosed within the ampersand symbol
33. If any column value in an arithmetic expression is null,
a. The query will create an error message.
b. The result will be zero.
c. The result is null.
d. The SQL interpreter can not process the query.
34. Which query will return three columns each with UPPER CASE column headin
gs?
a. SELECT "Department_id", "Last_name", "First_name"
FROM employees;
b. SELECT DEPARTMENT_ID, LAST_NAME, FIRST_NAME
FROM employees;
c. SELECT department_id, last_name, first_name AS UPPER CASE
FROM employees;
d. SELECT department_id, last_name, first_name
FROM employees;
35. When used in a WHERE clause, which logical condition operator will retur
n TRUE, only if both conditions are TRUE?
a. OR
b. NOT
c. AND
d. BETWEEN
36. In this database, product_id values are stored like XY01, XY02 while qua
ntity values are stored as numbers. After executing this query, which statement
below is TRUE?
SELECT quantity, product_id
FROM products
ORDER BY quantity and product_id
a. The results are sorted numerically.
b. The results are sorted first numerically then alphabetically.
c. The results are sorted first alphabetically then numerically.
d. The results are sorted alphabetically.
37. The following query will return which result?
SELECT last_name AS "Employee Name", job_id, code_number, hire_date
FROM employees
ORDER BY code_number ASC;
a. Results for the hire_date column will be displayed from smallest to larg
est date.
b. All column results will be ordered from smallest to largest value.
c. Results for the code_number column will be displayed from smallest numbe
r to largest number.
d. Only the code_number column will be returned.
38. You want to produce query results that display the last_name, first_name
, department_id and salary of all employees. Display the first_name, last_name
and department _id in ACS but for employees in the same department display the s
alary results in descending order. Also, if two employees have the same last_nam
e, you want the first names to be displayed in ascending order.
a. ORDER BY department_id, salary ASC, last_name, first_name DESC;
b. ORDER BY last_name, first_name,department_id, salary DESC
c. ORDER BY department_id, salary, last_name, first_name DESC;
d. ORDER BY department_id DESC, salary , last_name||' '||first_name ASC
39. In the following query, what will be evaluated first?
SELECT job_id, salary, hire_date
FROM employees
WHERE salary = 4000 OR job_id = 'AD_PRES' AND hire_date LIKE '03-JUN-04';
a. job_id = 'AD_PRES' AND hire_date LIKE '03-JUN-04';
b. salary = 4000 OR job_id = 'AD_PRES
c. salary = 4000
d. LIKE '03-JUN-04'
40. In the LIKE operator, which symbols can be used?
a. & and %
b. % and _
c. $ and /
d. * and _
41. The following query will return what values?
SELECT employee_id "number", salary "pay"
FROM employees
WHERE employee_id = 103 OR salary = 4000;
a. All employees plus those with employee id's of 103 whose salary is 4000.
b. Only employees with employee id's of 103 whose salary is 4000.
c. Any employee with an employee_id of 103 and also any employee whose sala
ry is 4000.
d. Employees with an employee_id equal to " number" whose salary values are
also equal to "pay".
42. What value(s) could be displayed?
SELECT prefix
FROM phone
WHERE prefix BETWEEN 360 AND 425
OR prefix IN(515, 206, 253)
AND BETWEEN 555 AND 904);
a. 625
b. 902
c. 410
d. 499
43. Which query will display of all employees whose last names start with "S
" and have an 'ae' anywhere in their last name?
a. SELECT last_name
FROM employees
WHERE last_name LIKE '_S%ae%';
b. SELECT last_name
FROM employees
WHERE last_name LIKE 'S_ae%';
c. SELECT last_name
FROM employees
WHERE last_name LIKE 'S&ae&';
d. SELECT last_name
FROM employees
WHERE last_name LIKE 'S%ae%';
44. A column may be sorted in an ORDER BY clause by: (choose all true answer
s)
a. column name or expression in the SELECT list.
b. A column alias in the SELECT list.
c. Placing the ORDER BY clause before the SELECT statement.
d. Putting a column number in the SELECT list.
45. The following query will return which result?
SELECT last_name, job_id, department_id, hire_date
FROM employees
ORDER BY 4 DESC;
a. Only column 4 will be displayed.
b. All 4 columns will be displayed in descending order.
c. 4 columns will be displayed with hire_dates displayed with the most rece
nt dates listed first.
d. The hire_date column
46. If hire_date is 13-May-04, write the format for each example below:
TRUNC(hire_date) = _____________
TRUNC(hire_date, 'MONTH') = ___________
ROUND(hire_date, 'YEAR') = ____________
47. Make "rein" out of "reindeer"? __________________
48. How do I take the "O" off of "Oracle"? ________________
49. How can I turn 'Snowman' into ****Snowman****?
Section 12
1. The explanation below is a column integrity constraint:
A column must contain only values consistent with the defined data format of the
column. True or False?
Mark for Review
(1) Points
True (*)
False

Correct

2. Identify all of the incorrect statements that complete this sentence: A pr


imary key is: (Choose three) Mark for Review
(1) Points
(Choose all correct answers)
A single column that uniquely identifies each column in a table (*)
One or more columns in a table that uniquely identifies each row in that tab
le
A set of columns in one table that uniquely identifies each row in another t
able (*)
Only one column that must be null (*)

Correct

3. The explanation below is a User Defined integrity rule and must therefore
be manually coded, the Database cannot enforce this rule automatically:
A primary key must be unique, and no part of the primary key can be null. True o
r False?
Mark for Review
(1) Points
True
False (*)

Correct

4. The text below is an example of what constraint type:


The value in the manager_id column of the EMPLOYEES table must match a value in
the employee_id column in the EMPLOYEES table.
Mark for Review
(1) Points
Entity integrity
User-defined integrity
Column integrity
Referential integrity (*)

Incorrect. Refer to Section 12

5. In a physical data model, an attribute becomes a _____________. Mark for


Review
(1) Points
Table
Foreign Key

Constraint
Column (*)

Correct

6. The transformation from an ER diagram to a physical design involves changi


ng terminology. Primary Unique Identifiers in the ER diagram become __________ a
nd relationships become ____________. Mark for Review
(1) Points
Foreign keys, Primary keys
Primary keys, Foreign keys (*)
Foreign keys, mandatory business rules
Unique Keys, Primary keys

Correct

7. In a physical data model, a relationship is represented as a combination o


f: (Choose Two) Mark for Review
(1) Points
(Choose all correct answers)
Column
Primary Key or Unique Key (*)
Check Constraint or Unique Key
Foreign Key (*)
Correct

8. It is possible to implement non-transferability via a simple Foreign Key R


elationship. True or False? Mark for Review
(1) Points
True
False (*)

Correct

9. Many to many relationships are implemented via a structure called a: _____


___________ Mark for Review
(1) Points
Supertype

Intersection Table (*)


Intersection Entity
Subtype

Incorrect. Refer to Section 12

10. When mapping supertypes, relationships at the supertype level transform a


s usual. Relationships at subtype level are implemented as foreign keys, but the
foreign key columns all become mandatory. True or False? Mark for Review
(1) Points
True
False (*)

Correct

Section 12
11. Which of the following are reasons why you should consider using a Subtyp
e Implementation? Mark for Review
(1) Points
The resulting table will reside in a single database and be used by just ONE
user.
When the common access paths for the supertypes are different.
Business functionality and business rules, access paths and frequency of acc
ess are all very different between subtypes. (*)
Most of the relationships are at the supertype level

Correct

Section 13
12. The _______ clause can be added to a SELECT statement to return a subset
of the data. Mark for Review
(1) Points
ANYWHERE
WHICH
WHERE (*)
EVERY

Correct.

13. The DESCRIBE command returns all rows from a table. True or False? Mark
for Review
(1) Points
True
False (*)

Incorrect. Refer to Section 13

Section 16
14. Which SQL keyword specifies that an alias will be substituted for a colum
n name in the output of a SQL query? Mark for Review
(1) Points
AS (*)
OR
AND
SUBSTITUTE

Correct.

15. You query the database with this SQL statement:


SELECT *
FROM transaction
WHERE product_id = 4569;
Which SQL SELECT statement capabilities are achieved when this statement is exec
uted?
Mark for Review
(1) Points
Selection only (*)
Projection only
Selection and projection only
Projection, selection and joining

Incorrect. See Section 16

16.
t:
SELECT (salary * raise_percent) raise
FROM employees;
If the RAISE_PERCENT column only contains null values, what will the statement r
eturn?
Mark for Review
(1) Points
Only zeroes
Only null values (*)
A null value or a zero depending on the value of the SALARY column
A null value or a numeric value depending on the value of the SALARY column

Correct.

17. What would you use in the SELECT clause to return all the columns in the
table? Mark for Review
(1) Points
An asterisk (*) (*)
A minus sign (-)
A plus sign (+)
The ALL keyword

Correct.

18. When you use the SELECT clause to list one or two columns only from a tab
le and no WHERE clause, which SQL capability is used? Mark for Review
(1) Points
Joining only
Selection only
Projection only (*)
Projection and Selection

Correct.

19. In a SELECT clause, what is the result of 2 + 3 * 2? Mark for Review


(1) Points
6
8 (*)
10

13

Correct.

20. You query the database with this SQL statement:


SELECT * FROM students;
Why would you use this statement?
Mark for Review
(1) Points
To insert data
To view data (*)
To display the table structure
To delete data

Correct.

Section 16
21. Any Non-UID must be dependant on the entire UID. True or False? Mark for
Review
(1) Points
True (*)
False
Correct

22. When is an entity in 2nd Normal Form? Mark for Review


(1) Points
When all non-UID attributes are dependent upon the entire UID. (*)
When no attritibutes are mutually independant and fully independent on the p
rimary key.
When no attritibutes are mutually independent and all are fully dependent on
the primary key.
None of the Above.

Incorrect. Refer to Section 6

Section 17
23. What does the DISTINCT keyword do when it is used in a SELECT clause? Ma
rk for Review
(1) Points
Hides NULL values
Eliminates all unique values and compares values
Eliminates duplicate rows in the result (*)
Eliminates only unique rows in the result

Correct. See Section 17

24. Which symbol represents the not equal to condition? Mark for Review
(1) Points
#

'+'
!= (*)
~

Correct.

25. Which statement best describes how column headings are displayed by defau
lt in Oracle Application Express: Mark for Review
(1) Points
Column headings are displayed left-justified and in lowercase.
Column headings are displayed left-justified and in uppercase.
Column headings are displayed centered and in uppercase. (*)
Column headings are displayed centered and in mixed case.

Correct. See Section 17

26. Which operator is used to combine columns of character strings to other c


olumns? Mark for Review
(1) Points
*
/
+
|| (*)

Correct. See Section 17

27. You need to display employees whose salary is in the range of 30000 and 5
0000. Which comparison operator should you use? Mark for Review
(1) Points
IN
LIKE
BETWEEN...AND... (*)
IS NULL

Correct.

28. Which clause would you include in a SELECT statement to restrict the data
returned to only the employees in department 10? Mark for Review
(1) Points
WHERE (*)
FROM
SELECT
IS

Correct.

29. Evaluate this SELECT statement:


SELECT *
FROM employees
WHERE department_id IN(10, 20, 30)
AND salary > 20000;
Which values would cause the logical condition to return TRUE?
Mark for Review
(1) Points
DEPARTMENT_ID = 10 and SALARY = 20000
DEPARTMENT_ID = 20 and SALARY = 20000
DEPARTMENT_ID = null and SALARY = 20001
DEPARTMENT_ID = 10 and SALARY = 20001 (*)

Correct. See Section 17

30. What will the result of the following SELECT statement be:
SELECT last_name, salary, salary + 300
FROM employees;
How will the heading for the SALARY column appear in the display by default in O
racle Application Express?
Mark for Review
(1) Points
Display the last name, salary and the results of adding 300 to each salary f
or all the employees (*)
Modify the salary column by adding 300 and displaying the last name, salary
and the new salary.
Modify the salary column by adding 300 and only display the last name and th
e new salary.
Display the last name, salary and the results of adding 300 to the salary of
the first employee row

Correct. See Section 17

Section 17
31. The PLAYERS table contains these columns:
PLAYER_ID NUMBER(9)
LAST_NAME VARCHAR2(20)
FIRST_NAME VARCHAR2 (20)
TEAM_ID NUMBER (4)
MANAGER_ID NUMBER (9)
POSITION_ID NUMBER (4)
Which SELECT statement should you use if you want to display unique combinations
of the TEAM_ID and MANAGER_ID columns?
Mark for Review
(1) Points
SELECT * FROM players;
SELECT team_id, manager_id FROM players;
SELECT DISTINCT team_id, manager_id FROM players; (*)
SELECT team_id, DISTINCT manager_id FROM players;
SELECT team_id, manager_id DISTINCT FROM players;

Correct.

32. You need write a SELECT statement that should only return rows that conta
in 34, 46, or 48 for the DEPARTMENT_ID column. Which operator should you use in
the WHERE clause to compare the DEPARTMENT_ID column to this specific list of va
lues? Mark for Review
(1) Points
=

!=
IN (*)
BETWEEN..AND..

Correct.

33.
statement will display both unique and non-unique combinations of the MANAGER_ID
and DEPARTMENT_ID values from the EMPLOYEES table? Mark for Review
(1) Points
SELECT manager_id, department_id DISTINCT FROM employees;
SELECT manager_id, department_id FROM employees; (*)
SELECT DISTINCT manager_id, department_id FROM employees;
SELECT manager_id, DISTINCT department_id FROM employees;

Incorrect. See Section 17.

34. The EMPLOYEES table contains these columns:


EMPLOYEE_ID NUMBER(9) PrimaryKey
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
DEPARTMENT_ID NUMBER(5) NOT NULL
MANAGER_ID NUMBER(9) NOT NULL
Evaluate these two SELECT statements:
1. SELECT DISTINCT employee_id, department_id, manager_id FROM employees;
2. SELECT employee_id, department_id, manager_id FROM employees;
Which of the following statements is true?
Mark for Review
(1) Points
The two statements will display the same data. (*)
The first statement will display a particular DEPARTMENT_ID only once.
The first statement will NOT display values from all of the rows in the EMPL
OYEES table
The second statement could display a unique combination of the EMPLOYEE_ID,
MANAGER_ID, and DEPARTMENT_ID values more than once.

Correct. See Section 17

35. The STUDENT table contains these columns:


STUDENT_ID NUMBER(10) Primary Key
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
MAIN_SUBJECT_ID NUMBER(3)
ADVISOR_ID NUMBER(5)
Evaluate this statement:
SELECT DISTINCT advisor_id, main_subject_id
FROM student;
Which statement is true?
Mark for Review
(1) Points
Each ADVISOR_ID can be displayed only once.
Each MAIN_SUBJECT_ID can be displayed more than once per ADVISOR_ID. (*)
Each combination of ADVISOR_ID and MAIN_SUBJECT_ID can be displayed more tha
n once.
Each MAIN_SUBJECT_ID can be displayed only once per query.

Incorrect. See Section 17

36. The EMPLOYEES table includes these columns:


EMPLOYEE_ID NUMBER(4) NOT NULL
LAST_NAME VARCHAR2(15) NOT NULL
FIRST_NAME VARCHAR2(10) NOT NULL
HIRE_DATE DATE NOT NULL
You want to produce a report that provides the first names, last names and hire
dates of those employees who were hired between March 1, 2000, and August 30, 20
00. Which statements can you issue to accomplish this task?
Mark for Review
(1) Points
SELECT last_name, first_name, hire_date
FROM employees
WHERE hire_date BETWEEN '01-MAR-00' AND '30-AUG-00';
(*)

SELECT last_name, first_name, hire_date


FROM employees
WHERE hire_date BETWEEN '30-AUG-00' AND '01-MAR-00';

SELECT last_name, first_name, hire_date


FROM employees
GROUP BY hire_date >= '01-MAR-00' and hire_date <= '30- AUG-00';

SELECT last_name, first_name, hire_date


FROM employees
AND hire_date >= '01-MAR-00' and hire_date <= '30-AUG- 00';

Correct.

Section 18
37. Evaluate this SQL statement:
SELECT e.employee_id, e.last_name, e.first_name, m.manager_id
FROM employees e, employees m
ORDER BY e.last_name, e.first_name
WHERE e.employee_id = m.manager_id;
This statement fails when executed. Which change will correct the problem?
Mark for Review
(1) Points
Reorder the clauses in the query. (*)
Remove the table aliases in the WHERE clause.
Remove the table aliases in the ORDER BY clause.
Include a HAVING clause.

Correct.

38. The PLAYERS table contains these columns:


PLAYERS TABLE:
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
SALARY NUMBER(8,2)
TEAM_ID NUMBER(4)
MANAGER_ID NUMBER(9)
POSITION_ID NUMBER(4)
You want to display all players' names with position 6900 or greater. You want t
he players names to be displayed alphabetically by last name and then by first n
ame. Which statement should you use to achieve the required results?
Mark for Review
(1) Points
SELECT last_name, first_name
FROM players
WHERE position_id >= 6900
ORDER BY last_name, first_name;
(*)

SELECT last_name, first_name


FROM players
WHERE position_id > 6900
ORDER BY last_name, first_name;

SELECT last_name, first_name


FROM players
WHERE position_id <= 6900
ORDER BY last_name, first_name;

SELECT last_name, first_name


FROM players
WHERE position_id >= 6900
ORDER BY last_name DESC, first_name;

Correct.

39. Evaluate this SELECT statement:


SELECT *
FROM employees
WHERE salary > 30000
AND department_id = 10
OR email IS NOT NULL;
Which statement is true?
Mark for Review
(1) Points
The OR condition will be evaluated before the AND condition.

The AND condition will be evaluated before the OR condition. (*)


The OR and AND conditions have the same precedence and will be evaluated fro
m left to right
The OR and AND conditions have the same precedence and will be evaluated fro
m right to left

Correct.

40. Evaluate this SELECT statement:


SELECT *
FROM employees
WHERE department_id = 34
OR department_id = 45
OR department_id = 67;
Which operator is the equivalent of the OR conditions used in this SELECT statem
ent?
Mark for Review
(1) Points
IN (*)
AND
LIKE
BETWEEN ... AND ...

Incorrect! See Section 18.


Section 18
41. You need to create a report to display all employees that were hired on o
r after January 1, 1996. The data should display in this format:
Employee Start Date and Salary
14837 - Smith 10-MAY-92 / 5000

Which SELECT statement could you use?


Mark for Review
(1) Points
SELECT employee_id || - || last_name "Employee",
hire_date || / || salary "Start Date and Salary"
FROM employees
WHERE hire_date <= '01-JAN-96';

SELECT employee_id ||' '|| last_name "Employee",


hire_date ||' '|| salary "Start Date and Salary"
FROM employees
WHERE hire_date <= '01-JAN-96';

SELECT employee_id ||'"- "|| last_name "Employee",


hire_date ||" / "|| salary "Start Date and Salary"
FROM employees
WHERE hire_date <= '01-JAN-96';

SELECT employee_id ||' - '|| last_name 'Employee',


hire_date ||' / '|| salary 'Start Date and Salary'
FROM employees
WHERE hire_date <= '01-JAN-96';

SELECT employee_id ||' - '|| last_name "Employee",


hire_date ||' / '|| salary "Start Date and Salary"
FROM employees
WHERE hire_date <= '01-JAN-96';
(*)

Incorrect! See Section 18.

42. You attempt to query the database with this SQL statement:
SELECT product_id "Product Number", category_id "Category", price "Price"
FROM products
WHERE "Category" = 5570
ORDER BY "Product Number";
This statement fails when executed. Which clause contains a syntax error?
Mark for Review
(1) Points
SELECT product_id "Product Number", category_id "Category", price "price"
ORDER BY "Product Number";
FROM products

WHERE "Category" = 5570 (*)

Incorrect! See Section 18.

43. Evaluate this SELECT statement:


SELECT employee_id, last_name, first_name, salary 'Yearly Salary'
FROM employees
WHERE salary IS NOT NULL
ORDER BY last_name, 3;
Which clause contains an error?
Mark for Review
(1) Points
SELECT employee_id, last_name, first_name, salary 'Yearly Salary' (*)
FROM employees
WHERE salary IS NOT NULL

ORDER BY last_name, 3;

Correct.

44. Evaluate this SELECT statement:


SELECT last_name, first_name, department_id, manager_id
FROM employees;
You need to sort data by manager id values and then alphabetically by employee l
ast name and first name values. Which ORDER BY clause could you use?
Mark for Review
(1) Points
ORDER BY department_id, last_name
ORDER BY manager_id, last_name, first_name (*)
ORDER BY last_name, first_name, manager_id
ORDER BY manager_id, first_name, last_name

Correct.

45. Which statement about the logical operators is true? Mark for Review
(1) Points
The order of operator precedence is AND, OR, and NOT.
The order of operator precedence is AND, NOT, and OR.
The order of operator precedence is NOT, OR, and AND.
The order of operator precedence is NOT, AND, and OR. (*)

Correct.

46. Which comparison condition means "Less Than or Equal To?" Mark for Revie
w
(1) Points
"=)"
"+<"
">="
"<=" (*)

Correct.

47. From left to right, what is the correct order of Precedence? Mark for Re
view
(1) Points
Arithmetic, Concatenation, Comparison, OR (*)
NOT, AND, OR, Arithmetic
Arithmetic, NOT, Logical, Comparison
Arithmetic, NOT, Concatenation, Logical

Correct.

48. Which statement about the ORDER BY clause is true? Mark for Review
(1) Points
You can use a column alias in the ORDER BY clause. (*)
The default sort order of the ORDER BY clause is descending.
The ORDER BY clause can only contain columns that are included in the SELECT
list.
The ORDER BY clause should immediately precede the FROM clause in a SELECT s
tatement

Correct.

49. Which clause would you include in a SELECT statement to sort the rows ret
urned by the LAST_NAME column? Mark for Review
(1) Points
ORDER BY (*)

WHERE
FROM
HAVING

Correct.

50. You need to change the default sort order of the ORDER BY clause so that
the data is displayed in reverse alphabetical order. Which keyword should you in
clude in the ORDER BY clause? Mark for Review
(1) Points
DESC (*)
ASC
SORT
CHANGE

Correct.
Section 12
1. Entity integrity refers to Mark for Review
(1) Points
Tables always containing text data
Tables always containing numeric data
Columns having Primary Keys, Foreign Keys, Unique Keys and Check constraints
defined in the database.
Tables having Primary Keys, Foreign Keys, Unique Keys and Check constraints
defined in the database. (*)

Incorrect. Refer to Section 12

2. The explanation below is a User Defined integrity rule and must therefore
be manually coded, the Database cannot enforce this rule automatically:
A primary key must be unique, and no part of the primary key can be null. True o
r False?
Mark for Review
(1) Points
True
False (*)

Correct

3. The explanation below is a column integrity constraint:


A column must contain only values consistent with the defined data format of the
column. True or False?
Mark for Review
(1) Points
True (*)
False

Correct

4. The text below is an example of what constraint type:


The value in the manager_id column of the EMPLOYEES table must match a value in
the employee_id column in the EMPLOYEES table.
Mark for Review
(1) Points
Entity integrity

User-defined integrity
Column integrity
Referential integrity (*)

Correct

5. An "Arc Implementation" can be done just like any other Relationship - you
simply add the required Foreign Keys. True or False? Mark for Review
(1) Points
True
False (*)

Correct

6. Which of the following are reasons why you should consider using a Subtype
Implementation? Mark for Review
(1) Points
The resulting table will reside in a single database and be used by just ONE
user.
When the common access paths for the supertypes are different.
Business functionality and business rules, access paths and frequency of acc
ess are all very different between subtypes. (*)
Most of the relationships are at the supertype level

Correct

7. What do you create when you transform a many to many relationship from you
r ER diagram into a physical design? Mark for Review
(1) Points
Unique key constraints
Intersection entity
Intersection table (*)
Two tables with Foreign key constraints between them

Correct

8. One-to-One relationships are transformed into Check Constraints in the tab


les created at either end of that relationship. True or False? Mark for Review
(1) Points

True
False (*)

Correct

9. Why would this table name NOT work in an Oracle database? this_year_end+ne
xt_year Mark for Review
(1) Points
Table names must begin with an alphabetic character
Too long
The Plus sign + is not allowed in object names (*)
None of the above

Correct

10.
a physical design involves changing terminology. Secondary Unique Identifiers b
ecome Mark for Review
(1) Points
Columns
Tables
Unique Constraints (*)
Primary Key Constraints

Correct
Section 12
11. In a physical data model, a relationship is represented as a combination
of: (Choose Two) Mark for Review
(1) Points
(Choose all correct answers)
Column
Primary Key or Unique Key (*)
Check Constraint or Unique Key
Foreign Key (*)

Incorrect. Refer to Section 12

Section 13
12. What command can be used to create a new row in a table in the database?
Mark for Review
(1) Points
CREATE
NEW
ADD
INSERT (*)
Incorrect. Refer to Section 13

13. The _______ clause can be added to a SELECT statement to return a subset
of the data. Mark for Review
(1) Points
ANYWHERE
WHICH
WHERE (*)
EVERY

Correct.

Section 16
14. Would it be a good idea to model age as an attribute of STUDENT? Mark fo
r Review
(1) Points
Yes
Maybe it could stop us having to calculate someone's age every time we need
it
Sometimes
No - it breaks the Normalization rules (*)

Incorrect. Refer to Section 6

15. When is an entity in 2nd Normal Form? Mark for Review


(1) Points

When all non-UID attributes are dependent upon the entire UID. (*)
When no attritibutes are mutually independant and fully independent on the p
rimary key.
When no attritibutes are mutually independent and all are fully dependent on
the primary key.
None of the Above.

Correct

16. You query the database with this SQL statement:


SELECT *
FROM transaction
WHERE product_id = 4569;
Which SQL SELECT statement capabilities are achieved when this statement is exec
uted?
Mark for Review
(1) Points
Selection only (*)
Projection only
Selection and projection only
Projection, selection and joining

Correct.

17. Which SQL statement will return an error? Mark for Review
(1) Points
SEL * FR sky; (*)
select star from sky;
SELECT star FROM sky;
SELECT * FROM sky;

Incorrect. See Section 16

18. You want to create a list of all albums that have been produced by the co
mpany. The list should include the title of the album, the artist's name, and th
e date the album was released. The ALBUMS table includes the following columns:
ALB_TITLE VARCHAR2(150) NOT NULL
ALB_ARTIST VARCHAR2(150) NOT NULL
ALB_DATE DATE NOT NULL
Which statement can you use to retrieve the necessary information?
Mark for Review
(1) Points
SELECT *
FROM albums;
(*)

SELECT alb_title, alb_artist, alb_dates


FROM album;

SELECT alb_title, alb_artist, alb_dates


FROM albums;
SELECT alb_title; alb_artist; alb_date
FROM albums;

Incorrect. See Section 16

19. You query the database with this SQL statement:


SELECT * FROM students;
Why would you use this statement?
Mark for Review
(1) Points
To insert data
To view data (*)
To display the table structure
To delete data

Correct.

20. When listing columns in the SELECT list, what should you use to separate
the columns? Mark for Review
(1) Points
Commas (*)
Semicolons
Dashes
Underscores

Incorrect. See Section 16


Section 16
21. The EMPLOYEES table contains these columns:
SALARY NUMBER(7,2)
BONUS NUMBER(7,2)
COMMISSION_PCT NUMBER(2,2)
All three columns contain values greater than zero. There is one row of data in
the table and the values are as follows:
Salary = 500, Bonus = 50, Commission_pct = .5
Evaluate these two SQL statements:
1.
SELECT salary + bonus + commission_pct * salary - bonus AS income
FROM employees;
2.
SELECT (salary + bonus ) + commission_pct * (salary - bonus) income
FROM employees;
What will be the result?
Mark for Review
(1) Points
Statement 1 will return a higher value than statement 2.
Statement 2 will return a higher value than statement 1. (*)
Statement 1 will display a different column heading.
One of the statements will NOT execute.

Incorrect. See Section 16

22. In a SELECT clause, what is the result of 2 + 3 * 2? Mark for Review


(1) Points
6
8 (*)
10
13

Correct.

Section 17
23. Evaluate this SELECT statement:
SELECT last_name, first_name, salary
FROM employees;
How will the heading for the SALARY column appear in the display by default in O
racle Application Express?
Mark for Review
(1) Points
The heading will display with the first character capitalized and centered.
The heading will display with the first character capitalized and left justi
fied.
The heading will display as uppercase and centered. (*)
The heading will display as uppercase and left justified.

Incorrect. See Section 17.


24. You need to display all the employees whose last name starts with the let
ters Sm . Which WHERE clause should you use? Mark for Review
(1) Points
WHERE last_name LIKE 'Sm%' (*)
WHERE last_name LIKE '%Sm'
WHERE last_name LIKE '_Sm'
WHERE last_name LIKE 'Sm_'

Incorrect. See Section 17

25. You want to determine the orders that have been placed by customers who r
eside in Chicago. You write this partial SELECT statement:
SELECT orderid, orderdate, total
FROM orders;
What should you include in your SELECT statement to achieve the desired results?
Mark for Review
(1) Points
AND city = Chicago;
AND city = 'Chicago';
WHERE city = 'Chicago'; (*)
WHERE city = Chicago;

Correct.

26. Which SELECT statement will display both unique and non-unique combinatio
ns of the MANAGER_ID and DEPARTMENT_ID values from the EMPLOYEES table? Mark fo
r Review
(1) Points
SELECT manager_id, department_id DISTINCT FROM employees;
SELECT manager_id, department_id FROM employees; (*)
SELECT DISTINCT manager_id, department_id FROM employees;
SELECT manager_id, DISTINCT department_id FROM employees;

Incorrect. See Section 17.

27. The PLAYERS table contains these columns:


PLAYER_ID NUMBER(9)
LAST_NAME VARCHAR2(20)
FIRST_NAME VARCHAR2 (20)
TEAM_ID NUMBER (4)
MANAGER_ID NUMBER (9)
POSITION_ID NUMBER (4)
Which SELECT statement should you use if you want to display unique combinations
of the TEAM_ID and MANAGER_ID columns?
Mark for Review
(1) Points
SELECT * FROM players;
SELECT team_id, manager_id FROM players;
SELECT DISTINCT team_id, manager_id FROM players; (*)
SELECT team_id, DISTINCT manager_id FROM players;
SELECT team_id, manager_id DISTINCT FROM players;

Incorrect. See Section 17.

28. The STUDENT table contains these columns:


STUDENT_ID NUMBER(10) Primary Key
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
MAIN_SUBJECT_ID NUMBER(3)
ADVISOR_ID NUMBER(5)
Evaluate this statement:
SELECT DISTINCT advisor_id, main_subject_id
FROM student;
Which statement is true?
Mark for Review
(1) Points
Each ADVISOR_ID can be displayed only once.
Each MAIN_SUBJECT_ID can be displayed more than once per ADVISOR_ID. (*)
Each combination of ADVISOR_ID and MAIN_SUBJECT_ID can be displayed more tha
n once.
Each MAIN_SUBJECT_ID can be displayed only once per query.

Correct. See Section 17

29. If you write queries using the BETWEEN operator it does not matter in wha
t order you enter the values, i.e. BETWEEN low value AND high value will give th
e same result as BETWEEN high value and low value. True or False? Mark for Revi
ew
(1) Points
True
False (*)
Incorrect. See Section 17.

30. The EMPLOYEES table contains these columns:


LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
EMAIL VARCHAR2(50)
You are writing a SELECT statement to retrieve the names of employees that have
an email address.
SELECT last_name||', '||first_name "Employee Name"
FROM employees;
Which WHERE clause should you use to complete this statement?
Mark for Review
(1) Points
WHERE email = NULL;

WHERE email != NULL;


WHERE email IS NULL;
WHERE email IS NOT NULL; (*)

Incorrect. See Section 17.


Section 17
31. The Concatenation Operator does which of the following? Mark for Review
(1) Points
Links rows of data together inside the database.
Links two or more columns or literals to form a single output column (*)
Is represented by the asterisk (*) symbol
Separates columns.

Incorrect. See Section 17

32. You need to display only unique combinations of the LAST_NAME and MANAGER
_ID columns in the EMPLOYEES table. Which keyword should you include in the SELE
CT clause? Mark for Review
(1) Points
ONLY
UNIQUE
DISTINCT (*)
DISTINCTROW
Correct. See Section 17

33. Which statement best describes how column headings are displayed by defau
lt in Oracle Application Express: Mark for Review
(1) Points
Column headings are displayed left-justified and in lowercase.
Column headings are displayed left-justified and in uppercase.
Column headings are displayed centered and in uppercase. (*)
Column headings are displayed centered and in mixed case.

Correct. See Section 17

34. You need to display employees whose salary is in the range of 30000 and 5
0000. Which comparison operator should you use? Mark for Review
(1) Points
IN
LIKE
BETWEEN...AND... (*)
IS NULL

Correct.

35. When using the LIKE condition, which symbol represents any sequence of no
ne, one or more characters? Mark for Review
(1) Points
_
% (*)

#
&

Correct.

36. Which comparison condition would you use to select rows that match a char
acter pattern? Mark for Review
(1) Points
IN
LIKE (*)
ALMOST
SIMILAR

Correct.

Section 18
37. The EMPLOYEES table contains these columns:
EMPLOYEE_ID NUMBER(9) PK
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
DEPARTMENT_ID NUMBER(9)
Compare these two SQL statements:
1.
SELECT DISTINCT department_id DEPT, last_name, first_name
FROM employees
ORDER BY department_id;
2.
SELECT department_id DEPT, last_name, first_name
FROM employees
ORDER BY DEPT;
How will the results differ?
Mark for Review
(1) Points
One of the statements will return a syntax error.
One of the statements will eliminate all duplicate DEPARTMENT_ID values.
There is no difference in the result between the two statements. (*)
The statements will sort on different column values.

Correct.

38. The PLAYERS table contains these columns:


PLAYERS TABLE:
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
SALARY NUMBER(8,2)
TEAM_ID NUMBER(4)
MANAGER_ID NUMBER(9)
POSITION_ID NUMBER(4)
You must display the player name, team id, and salary for players whose salary i
s in the range from 25000 through 100000 and whose team id is in the range of 12
00 through 1500. The results must be sorted by team id from lowest to highest an
d then further sorted by salary from highest to lowest. Which statement should y
ou use to display the desired result?
Mark for Review
(1) Points
SELECT last_name, first_name, team_id, salary
FROM players
WHERE (salary > 25000 OR salary < 100000)
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id, salary;

SELECT last_name, first_name, team_id, salary


FROM players
WHERE salary BETWEEN 25000 AND 100000
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id, salary DESC;
(*)

SELECT last_name, first_name, team_id, salary


FROM players
WHERE salary > 24999.99 AND salary < 100000
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id ASC, salary DESC;

SELECT last_name, first_name, team_id, salary


FROM players
WHERE salary BETWEEN 24999.99 AND 100000.01
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id DESC, salary DESC;

Incorrect! See Section 18.

39. Which comparison condition means "Less Than or Equal To?" Mark for Revie
w
(1) Points
"=)"
"+<"

">="
"<=" (*)

Correct.

40. Which statement about the logical operators is true? Mark for Review
(1) Points
The order of operator precedence is AND, OR, and NOT.
The order of operator precedence is AND, NOT, and OR.
The order of operator precedence is NOT, OR, and AND.
The order of operator precedence is NOT, AND, and OR. (*)

Correct.
Section 18

41.
Which of the following is TRUE regarding the logical AND operator? Mark fo
r Review
(1) Points

TRUE AND TRUE return FALSE

TRUE AND FALSE return TRUE

FALSE AND TRUE return NULL

TRUE AND FALSE return FALSE (*)

Incorrect. See Section 18


42.
Which of the following best describes the meaning of the LIKE operator?
Mark for Review
(1) Points

Display rows based on a range of values.

To test for values in a list.

Match a character pattern. (*)

To find Null values.

Correct.

43.
You need to change the default sort order of the ORDER BY clause so that the dat
a is displayed in reverse alphabetical order. Which keyword should you include i
n the ORDER BY clause? Mark for Review
(1) Points

DESC (*)
ASC

SORT

CHANGE

Correct.

44.
Which clause would you include in a SELECT statement to sort the rows returned b
y the LAST_NAME column? Mark for Review
(1) Points

ORDER BY (*)

WHERE

FROM

HAVING
Correct.

45.
Evaluate this SELECT statement:
SELECT last_name, first_name, department_id, manager_id
FROM employees;
You need to sort data by manager id values and then alphabetically by employee l
ast name and first name values. Which ORDER BY clause could you use? Mark fo
r Review
(1) Points

ORDER BY department_id, last_name

ORDER BY manager_id, last_name, first_name (*)

ORDER BY last_name, first_name, manager_id

ORDER BY manager_id, first_name, last_name


Correct.

46.
Evaluate this SELECT statement:
SELECT *
FROM employees
WHERE salary > 30000
AND department_id = 10
OR email IS NOT NULL;
Which statement is true? Mark for Review
(1) Points

The OR condition will be evaluated before the AND condition.

The AND condition will be evaluated before the OR condition. (*)

The OR and AND conditions have the same precedence and will be evaluated from le
ft to right

The OR and AND conditions have the same precedence and will be evaluated from ri
ght to left

Correct.
47.
Evaluate this SELECT statement:
SELECT *
FROM employees
WHERE department_id = 34
OR department_id = 45
OR department_id = 67;
Which operator is the equivalent of the OR conditions used in this SELECT statem
ent? Mark for Review
(1) Points

IN (*)

AND

LIKE

BETWEEN ... AND ...

Correct.

48.
You attempt to query the database with this SQL statement:
SELECT product_id "Product Number", category_id "Category", price "Price"
FROM products
WHERE "Category" = 5570
ORDER BY "Product Number";
This statement fails when executed. Which clause contains a syntax error?
Mark for Review
(1) Points

SELECT product_id "Product Number", category_id "Category", price "price"

ORDER BY "Product Number";

FROM products

WHERE "Category" = 5570 (*)

Correct.

49.
Evaluate this SELECT statement:
SELECT employee_id, last_name, first_name, salary 'Yearly Salary'
FROM employees
WHERE salary IS NOT NULL
ORDER BY last_name, 3;
Which clause contains an error? Mark for Review
(1) Points
SELECT employee_id, last_name, first_name, salary 'Yearly Salary' (*)

FROM employees

WHERE salary IS NOT NULL

ORDER BY last_name, 3;

Correct.

50.
You need to create a report to display all employees that were hired on or after
January 1, 1996. The data should display in this format:
Employee Start Date and Salary
14837 - Smith 10-MAY-92 / 5000
Which SELECT statement could you use? Mark for Review
(1) Points

SELECT employee_id || - || last_name "Employee",


hire_date || / || salary "Start Date and Salary"
FROM employees
WHERE hire_date <= '01-JAN-96';
SELECT employee_id ||' '|| last_name "Employee",
hire_date ||' '|| salary "Start Date and Salary"
FROM employees
WHERE hire_date <= '01-JAN-96';

SELECT employee_id ||'"- "|| last_name "Employee",


hire_date ||" / "|| salary "Start Date and Salary"
FROM employees
WHERE hire_date <= '01-JAN-96';

SELECT employee_id ||' - '|| last_name 'Employee',


hire_date ||' / '|| salary 'Start Date and Salary'
FROM employees
WHERE hire_date <= '01-JAN-96';

SELECT employee_id ||' - '|| last_name "Employee",


hire_date ||' / '|| salary "Start Date and Salary"
FROM employees
WHERE hire_date <= '01-JAN-96';
(*)
Correct.
Section 12

1. When mapping supertypes, relationships at the supertype level transform as


usual. Relationships at subtype level are implemented as foreign keys, but the
foreign key columns all become mandatory. True or False? Mark for Review
(1) Points

True
False (*)

Correct

2. Which of the following are reasons why you should consider using a Subtype
Implementation? Mark for Review
(1) Points
The resulting table will reside in a single database and be used by just ONE
user.
When the common access paths for the supertypes are different.
Business functionality and business rules, access paths and frequency of acc
ess are all very different between subtypes. (*)
Most of the relationships are at the supertype level

Correct

3. It is possible to implement non-transferability via a simple Foreign Key R


elationship. True or False? Mark for Review
(1) Points
True
False (*)

Correct

4. Many to many relationships are implemented via a structure called a: _____


___________ Mark for Review
(1) Points
Supertype
Intersection Table (*)
Intersection Entity
Subtype

Incorrect. Refer to Section 12

5. Entity integrity refers to Mark for Review


(1) Points
Tables always containing text data
Tables always containing numeric data

Columns having Primary Keys, Foreign Keys, Unique Keys and Check constraints
defined in the database.
Tables having Primary Keys, Foreign Keys, Unique Keys and Check constraints
defined in the database. (*)

Incorrect. Refer to Section 12

6. If a primary key is a set of columns then one column must be null. True or
False? Mark for Review
(1) Points
True
False (*)

Correct

7. A table must have a primary key. True or False? Mark for Review
(1) Points
True
False (*)

Correct

8. Identify all of the incorrect statements that complete this sentence: A pr


imary key is: (Choose three) Mark for Review
(1) Points

(Choose all correct answers)


A single column that uniquely identifies each column in a table (*)
One or more columns in a table that uniquely identifies each row in that tab
le
A set of columns in one table that uniquely identifies each row in another t
able (*)
Only one column that must be null (*)

Correct

9. Why would this table name NOT work in an Oracle database? this_year_end+ne
xt_year Mark for Review
(1) Points
Table names must begin with an alphabetic character

Too long
The Plus sign + is not allowed in object names (*)
None of the above

Correct

10. The transformation from an ER diagram to a physical design involves chang


ing terminology. Primary Unique Identifiers in the ER diagram become __________
and relationships become ____________. Mark for Review
(1) Points
Foreign keys, Primary keys
Primary keys, Foreign keys (*)
Foreign keys, mandatory business rules
Unique Keys, Primary keys

Incorrect. Refer to Section 12


Section 12
11. In an Oracle database, why would 1_TABLE not work as a table name? Mark
for Review
(1) Points
The database does not understand all capital letters
There is no problem here. You can create a table called 1_TABLE.
Object names must not start with a number. They must begin with a letter (*)

TABLE is a reserved word

Correct

Section 13
12. What command will return data from the database to you? Mark for Review
(1) Points
FETCH
GET
SELECT (*)
RETURN

Correct.

13. The DESCRIBE command returns all rows from a table. True or False? Mark
for Review
(1) Points
True
False (*)

Correct.
Section 16
14. Which SQL keyword specifies that an alias will be substituted for a colum
n name in the output of a SQL query? Mark for Review
(1) Points
AS (*)
OR
AND
SUBSTITUTE

Correct.

15. In a SQL statement, which clause specifies one or more columns to be retu
rned by the query? Mark for Review
(1) Points
SELECT (*)
FROM
WHERE
Any of the above options, you can list columns wherever you want to in a SEL
ECT statement.

Correct.

16. The SELECT statement retrieves information from the database. In a SELECT
statement, you can do all of the following EXCEPT: Mark for Review
(1) Points
Projection
Manipulation (*)

Joining
Selection

Correct.

17. When you use the SELECT clause to list one or two columns only from a tab
le and no WHERE clause, which SQL capability is used? Mark for Review
(1) Points
Joining only
Selection only
Projection only (*)
Projection and Selection

Correct.

18. You query the database with this SQL statement:


SELECT *
FROM transaction
WHERE product_id = 4569;
Which SQL SELECT statement capabilities are achieved when this statement is exec
uted?
Mark for Review
(1) Points
Selection only (*)
Projection only

Selection and projection only


Projection, selection and joining

Correct.

19. Which SQL statement will return an error? Mark for Review
(1) Points
SEL * FR sky; (*)
select star from sky;
SELECT star FROM sky;
SELECT * FROM sky;

Incorrect. See Section 16

20. In a SELECT clause, what is the result of 2 + 3 * 2? Mark for Review


(1) Points
6
8 (*)
10
13

Correct.
Section 16
21. Would it be a good idea to model age as an attribute of STUDENT? Mark fo
r Review
(1) Points
Yes
Maybe it could stop us having to calculate someone's age every time we need
it
Sometimes
No - it breaks the Normalization rules (*)

Correct

22. Any Non-UID must be dependant on the entire UID. True or False? Mark for
Review
(1) Points

True (*)
False

Correct

Section 17
23. You need to display all the employees whose last name starts with the let
ters Sm . Which WHERE clause should you use? Mark for Review
(1) Points
WHERE last_name LIKE 'Sm%' (*)
WHERE last_name LIKE '%Sm'
WHERE last_name LIKE '_Sm'

WHERE last_name LIKE 'Sm_'

Incorrect. See Section 17

24. You want to retrieve a list of customers whose last names begin with the
letters Fr . Which symbol should you include in the WHERE clause of your SELECT
statement to achieve the desired result? Mark for Review
(1) Points
% (*)
~
#
*

Correct. See Section 17

25. If the EMPLOYEES table has the following columns, and you want to write a
SELECT statement to return the employee last name and department number for emp
loyee number 176, which of the following SQL statements should you use?
Name Type Length
EMPLOYEE_ID NUMBER 22
FIRST_NAME VARCHAR2 20
LAST_NAME VARCHAR2 25
EMAIL VARCHAR2 25
PHONE_NUMBER VARCHAR2 20
SALARY NUMBER 22
COMMISSION_PCT NUMBER 22
MANAGER_ID NUMBER 22
DEPARTMENT_ID NUMBER 22

Mark for Review


(1) Points
SELECT last_name, department_id
FROM employees
WHERE employee_id = 176;
(*)

SELECT last_name, department_id


FROM employees
WHERE employee_id equals 176;

SELECT first_name, employee_id


FROM employees
WHERE employee_id = 176;

SELECT last_name, employee_id


FROM employees
WHERE employee_id equals 176;

Correct.

26. You need to display all the values in the EMAIL column that contains the
underscore (_) character as part of that email address. The WHERE clause in your
SELECT statement contains the LIKE operator. What must you include in the LIKE
operator? Mark for Review
(1) Points
The ESCAPE option (\) and one or more percent signs (%)
The (+) operator
A percent sign (%)
The ESCAPE option (\) (*)

Correct. See Section 17

27. Evaluate this SELECT statement:


SELECT last_name, first_name, salary
FROM employees;
How will the heading for the SALARY column appear in the display by default in O
racle Application Express?
Mark for Review
(1) Points
The heading will display with the first character capitalized and centered.
The heading will display with the first character capitalized and left justi
fied.

The heading will display as uppercase and centered. (*)


The heading will display as uppercase and left justified.

Correct.

28. Which operator is used to combine columns of character strings to other c


olumns? Mark for Review
(1) Points
*
/
+
|| (*)

Correct. See Section 17

29. Which comparison condition would you use to select rows that match a char
acter pattern? Mark for Review
(1) Points
IN
LIKE (*)
ALMOST
SIMILAR
Correct.

30. Which statement best describes how column headings are displayed by defau
lt in Oracle Application Express: Mark for Review
(1) Points
Column headings are displayed left-justified and in lowercase.
Column headings are displayed left-justified and in uppercase.
Column headings are displayed centered and in uppercase. (*)
Column headings are displayed centered and in mixed case.

Correct. See Section 17


Section 17
31. You need to display only unique combinations of the LAST_NAME and MANAGER
_ID columns in the EMPLOYEES table. Which keyword should you include in the SELE
CT clause? Mark for Review
(1) Points
ONLY
UNIQUE
DISTINCT (*)
DISTINCTROW

Correct. See Section 17

32. Which symbol represents the not equal to condition? Mark for Review
(1) Points
#
'+'

!= (*)
~

Incorrect. See Section 17.

33. The Concatenation Operator does which of the following? Mark for Review
(1) Points
Links rows of data together inside the database.
Links two or more columns or literals to form a single output column (*)
Is represented by the asterisk (*) symbol
Separates columns.

Correct. See Section 17

34. The PRODUCT table contains these columns:


PRODUCT_ID NUMBER(9)
DESCRIPTION VARCHAR2(20)
COST NUMBER(5,2)
LOCATION_ID VARCHAR2(10)
You want to display product costs with these desired results: 1. The cost displa
yed for each product is increased by 10 percent. 2. The product location id must
be 4859, 9789, or 9898. 3. Ten percent of the original cost is less than $10. W
hich statement should you issue?
Mark for Review
(1) Points
SELECT product_id, cost * 1.10
FROM product
WHERE cost * .10 < 10.00
AND location_id IN (4859, 9789, 9898);
(*)

SELECT product_id, cost * .10


FROM product
WHERE cost * 1.10 > 10.00
AND location_id IN (4859, 9789, 9898);

SELECT product_id, cost * 1.10


FROM product
WHERE cost * 1.10 < 10.00
AND location_id = (4859, 9789, 9898);

SELECT product_id, cost * 1.10


FROM product
WHERE cost * .10 > 10.00
AND location_id = (4859, 9789, 9898);

Correct. See Section 17

35. If you write queries using the BETWEEN operator it does not matter in wha
t order you enter the values, i.e. BETWEEN low value AND high value will give th
e same result as BETWEEN high value and low value. True or False? Mark for Revi
ew
(1) Points
True
False (*)
Correct.

36. The EMPLOYEES table contains these columns:


EMPLOYEE_ID NUMBER(9) PrimaryKey
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
DEPARTMENT_ID NUMBER(5) NOT NULL
MANAGER_ID NUMBER(9) NOT NULL
Evaluate these two SELECT statements:
1. SELECT DISTINCT employee_id, department_id, manager_id FROM employees;
2. SELECT employee_id, department_id, manager_id FROM employees;
Which of the following statements is true?
Mark for Review
(1) Points
The two statements will display the same data. (*)
The first statement will display a particular DEPARTMENT_ID only once.

The first statement will NOT display values from all of the rows in the EMPL
OYEES table
The second statement could display a unique combination of the EMPLOYEE_ID,
MANAGER_ID, and DEPARTMENT_ID values more than once.

Correct. See Section 17

Section 18
37. Which logical operator returns TRUE if either condition is true? Mark fo
r Review
(1) Points
OR (*)
AND

NOT
BOTH

Correct.

38. Which clause would you include in a SELECT statement to sort the rows ret
urned by the LAST_NAME column? Mark for Review
(1) Points
ORDER BY (*)
WHERE
FROM
HAVING

Correct.

39. Which statement about the logical operators is true? Mark for Review
(1) Points
The order of operator precedence is AND, OR, and NOT.
The order of operator precedence is AND, NOT, and OR.
The order of operator precedence is NOT, OR, and AND.
The order of operator precedence is NOT, AND, and OR. (*)

Correct.

40. The ORDER BY clause always comes last. True or False? Mark for Review
(1) Points
True (*)
False

Correct.
Section 18
41. Which of the following is TRUE regarding the logical AND operator? Mark
for Review
(1) Points
TRUE AND TRUE return FALSE
TRUE AND FALSE return TRUE
FALSE AND TRUE return NULL

TRUE AND FALSE return FALSE (*)

Correct.

42. Which statement about the ORDER BY clause is true? Mark for Review
(1) Points
You can use a column alias in the ORDER BY clause. (*)
The default sort order of the ORDER BY clause is descending.
The ORDER BY clause can only contain columns that are included in the SELECT
list.
The ORDER BY clause should immediately precede the FROM clause in a SELECT s
tatement

Correct.

43. The PLAYERS table contains these columns:


PLAYERS TABLE:
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
SALARY NUMBER(8,2)
TEAM_ID NUMBER(4)
MANAGER_ID NUMBER(9)
POSITION_ID NUMBER(4)
You want to display all players' names with position 6900 or greater. You want t
he players names to be displayed alphabetically by last name and then by first n
ame. Which statement should you use to achieve the required results?
Mark for Review
(1) Points

SELECT last_name, first_name


FROM players
WHERE position_id >= 6900
ORDER BY last_name, first_name;
(*)

SELECT last_name, first_name


FROM players
WHERE position_id > 6900
ORDER BY last_name, first_name;

SELECT last_name, first_name


FROM players
WHERE position_id <= 6900
ORDER BY last_name, first_name;

SELECT last_name, first_name


FROM players
WHERE position_id >= 6900
ORDER BY last_name DESC, first_name;

Correct.

44. Evaluate this SQL statement:


SELECT e.employee_id, e.last_name, e.first_name, m.manager_id
FROM employees e, employees m
ORDER BY e.last_name, e.first_name
WHERE e.employee_id = m.manager_id;
This statement fails when executed. Which change will correct the problem?
Mark for Review
(1) Points
Reorder the clauses in the query. (*)
Remove the table aliases in the WHERE clause.
Remove the table aliases in the ORDER BY clause.
Include a HAVING clause.

Correct.

45. Evaluate this SELECT statement:


SELECT last_name, first_name, salary
FROM employees;
How will the results of this query be sorted?
Mark for Review
(1) Points
The database will display the rows in whatever order it finds it in the data
base, so no particular order. (*)
The results will be sorted ascending by the LAST_NAME column only.
The results will be sorted ascending by LAST_NAME and FIRST_NAME only.
The results will be sorted ascending by LAST_NAME, FIRST_NAME, and SALARY.

Correct.

46. Evaluate this SELECT statement:


SELECT last_name, first_name, email
FROM employees
ORDER BY email;
If the EMAIL column contains null values, which statement is true?
Mark for Review
(1) Points
Null email values will be displayed first in the result.

Null email values will be displayed last in the result. (*)


Null email values will not be displayed in the result.
The result will not be sorted.

Correct.

47. Evaluate this SELECT statement:


SELECT *
FROM employees
WHERE department_id = 34
OR department_id = 45
OR department_id = 67;
Which operator is the equivalent of the OR conditions used in this SELECT statem
ent?
Mark for Review
(1) Points
IN (*)
AND
LIKE
BETWEEN ... AND ...

Correct.

48. You query the database with this SQL statement:


SELECT price
FROM products
WHERE price IN(1, 25, 50, 250)
AND (price BETWEEN 25 AND 40 OR price > 50);
Which two values could the statement return? (Choose two.)
Mark for Review
(1) Points
(Choose all correct answers)
1
50
25 (*)
10
250 (*)
100

Correct.

49. Evaluate this SQL statement:


SELECT product_id, product_name, price
FROM products
ORDER BY product_name, price;
What occurs when the statement is executed?
Mark for Review
(1) Points
The results are sorted numerically only.
The results are sorted alphabetically only.
The results are sorted numerically and then alphabetically.
The results are sorted alphabetically and then numerically. (*)

Correct.

50. Which SELECT statement should you use to limit the display of product inf
ormation to those products with a price of less than 50? Mark for Review
(1) Points
SELECT product_id, product_name
FROM products
WHERE price < 50;
(*)

SELECT product_id, product_name


FROM products
HAVING price < 50;

SELECT product_id, product_name


FROM products
WHERE price <= 50;

SELECT product_id, product_name


FROM products
GROUP BY price < 50;

SELECT product_id, product_name


FROM products
WHERE price < 50.00
GROUP BY price;

Correct.
Section 12 Lesson 1(Answer all questions in this section)
1. A foreign key can not refer
to a primary key in the same table. True or False?
True
False2. Identify all of the incorrect statements that complete this sentence: A
primary key is:
(Choose Three)
(Choose all correct answers)
A single column that uniquely identifies each column in a table
One or more columns in a table that uniquely identifies each row in that table
A set of columns in one table that uniquely identifies each row in another table
Only one column that must be null
3. A table must have a primary key. True or False?
True
False4. If a primary key is a set of columns then one column must be null. True
or False?
True
False
Section 12 Lesson 2(Answer all questions in this section)
5.Why
would this table name NOT work in an Oracle database? This_year_end+next_year
Table names must begin with an alphabetic character
Too long
The Plus sign + is not allowed in object names
None of the above
6. The transformation from an ER diagram to a physical design involves changing
terminology. Secondary Unique Identifiers becomes
Columns
Table

You might also like