Vous êtes sur la page 1sur 19

Test: Final Exam Semester 1

Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Semester 1 Final Exam covers Sections 11-17 of Database Design.
Section 15
(Answer all questions in this section)
1. What would you use in the SELECT clause to return all the columns in the t
able? Mark for Review
(1) Points
An asterisk (*) (*)
A minus sign (-)
A plus sign (+)
The ALL keyword
Correct.
2. Evaluate this SELECT statement:
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
Incorrect. See Section 15 Lesson 1.
3. When listing columns in the SELECT list, what should you use to separate t
he columns? Mark for Review
(1) Points
Commas (*)
Semicolons
Dashes

Underscores
Correct.
4. 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 15 Lesson 1.
5. 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;
Correct.
6. 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.
7. In which clause of a SELECT statement would you specify the name of the ta
ble or tables being queried? Mark for Review
(1) Points
The FROM clause (*)
The SELECT clause
The WHERE clause
Any of the above options, you can list tables wherever you want to in a SELE
CT statement.
Correct.

Section 16
(Answer all questions in this section)
8. 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 16 Lesson 3.
9. You need to display all the values in the EMAIL column that contains the u
nderscore (_) 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 o
perator? Mark for Review
(1) Points
The ESCAPE option (\) and one or more percent signs (%)
The (+) operator
A percent sign (%)
The ESCAPE option (\) (*)
Incorrect. See Section 16 Lesson 2.
10. 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;
Incorrect. See Section 16 Lesson 2.

Page 1 of 5

Test: Final Exam Semester 1

Review your answers, feedback, and question scores below. An asterisk (*) indica

tes a correct answer.


Semester 1 Final Exam covers Sections 11-17 of Database Design.
Section 16
(Answer all questions in this section)
11. 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 16 Lesson 2.
12. 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 (*)
Incorrect. See Section 16 Lesson 2.
13. Which of the following commands will display the last name concatenated w
ith the job ID from the employees table, separated by a comma and space, and lab
el the resulting column "Employee and Title"? Mark for Review

(1) Points
SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM employees;
SELECT last_name||', '|| job_id "Employee and Title" FROM employees; (*)
SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM emp;
SELECT last_name||","|| job_id "Employee and Title" FROM employees;
Incorrect. See Section 16 Lesson 2.
14. 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
Incorrect. See Section 16 Lesson 1.
15. When using the LIKE condition, which symbol represents any sequence of no
ne, one or more characters? Mark for Review
(1) Points
_
% (*)
#
&
Incorrect. See Section 16 Lesson 1.
16. Which of the following elements cannot be included in a WHERE clause? Ma
rk for Review
(1) Points
A column alias (*)
A column name
A comparison condition
A constant

Correct.
17. Which comparison operator searches for a specified character pattern? Ma
rk for Review
(1) Points
IN
LIKE (*)
BETWEEN...AND...
IS NULL
Incorrect. See Section 16 Lesson 1.
18. Where in a SQL statement can you not use arithmetic operators? Mark for
Review
(1) Points
SELECT
FROM (*)
WHERE
NONE
Incorrect. See Section 16 Lesson 1.
19. Which comparison condition would you use to select rows that match a char
acter pattern? Mark for Review
(1) Points
IN
LIKE (*)
ALMOST
SIMILAR
Incorrect. See Section 16 Lesson 1.
20. 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 16 Lesson 1.

Page 2 of 5

Test: Final Exam Semester 1

Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Semester 1 Final Exam covers Sections 11-17 of Database Design.
Section 12
(Answer all questions in this section)
21. What command will return data from the database to you? Mark for Review
(1) Points
FETCH
GET
SELECT (*)
RETURN
Incorrect. Refer to Section 12 Lesson 1.
22. 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
Incorrect. Refer to Section 12 Lesson 1.
23. 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 12 Lesson 1.
24. The f_customers table contains the following data:
ID Name Address City State Zip
1 Cole Bee 123 Main Street Orlando FL 32838
2 Zoe Twee 1009 Oliver Avenue Boston MA 02116
3 Sandra Lee 22 Main Street Tampa FL 32444
If you run the following statement:
DELETE FROM F_CUSTOMERS WHERE ID <= 2;
How many rows will be left in the table?
Mark for Review
(1) Points
0
3
1 (*)
2
Incorrect. Refer to Section 12 Lesson 2.
25. The SQL statement ALTER TABLE EMPLOYEES DELETE COLUMN SALARY is a valid s
tatement. True or False? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 12 Lesson 2.

Section 11
(Answer all questions in this section)
26. In a physical data model, an attribute becomes a _____________. Mark for
Review
(1) Points

Table
Foreign Key
Constraint
Column (*)
Incorrect. Refer to Section 11 Lesson 2.
27. 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
Incorrect. Refer to Section 11 Lesson 2.
28. The transformation from an ER diagram to a physical design involves chang
ing terminology. Secondary Unique Identifiers become Mark for Review
(1) Points
Columns
Tables
Unique Constraints (*)
Primary Key Constraints
Incorrect. Refer to Section 11 Lesson 2.
29. A table must have at least one candidate key, as well as its primary key.
True or False? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 11 Lesson 1.
30. If a primary key is a set of columns then one column must be null. True o
r False? Mark for Review

(1) Points
True
False (*)
Incorrect. Refer to Section 11 Lesson 1.

Page 3 of 5

Test: Final Exam Semester 1

Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Semester 1 Final Exam covers Sections 11-17 of Database Design.
Section 11
(Answer all questions in this section)
31. A foreign key cannot refer to a primary key in the same table. True or Fa
lse? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 11 Lesson 1.
32. A table must have a primary key. True or False? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 11 Lesson 1.
33. Identify all of the incorrect statements that complete this sentence: A p
rimary 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 (*)
Incorrect. Refer to Section 11 Lesson 1.
34. An "Arc Implementation" can be done just like any other Relationship - yo
u simply add the required Foreign Keys. True or False? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 11 Lesson 4.
35. The Oracle Database can implement a many to many relationship. You simply
create two foreign keys between the two tables. True or False? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 12

Section 17
(Answer all questions in this section)
36. Evaluate this SELECT statement:
SELECT first_name, last_name, email
FROM employees
ORDER BY last_name;
Which statement is true?
Mark for Review
(1) Points
The rows will not be sorted.
The rows will be sorted alphabetically by the LAST_NAME values. (*)
The rows will be sorted in reverse alphabetical order by the LAST_NAME value
s.

The rows will be sorted alphabetically by the FIRST_NAME and then the LAST_N
AME values
Incorrect! See Section 17 Lesson 2.
37. 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.
38. 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.
39. 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 (*)
Incorrect! See Section 17 Lesson 2.
40. Evaluate this SELECT statement:
SELECT employee_id, last_name, first_name, salary
FROM employees
WHERE salary IS NOT NULL
ORDER BY last_name, 3;

Yearly Salary'

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;
Incorrect! See Section 17 Lesson 2.

Page 4 of 5

Test: Final Exam Semester 1

Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Semester 1 Final Exam covers Sections 11-17 of Database Design.
Section 17
(Answer all questions in this section)

41. What value will the following SQL statement return?


SELECT employee_id
FROM employees
WHERE employee_id BETWEEN 100 AND 150
OR employee_id IN(119, 175, 205)
AND (employee_id BETWEEN 150 AND 200);
Mark for Review
(1) Points
19
No rows will be returned
100, 101, 102, 103, 104, 107, 124, 141, 142, 143, 144, 149 (*)
200, 201, 202, 203, 204, 205, 206
Incorrect! See Section 17 Lesson 2.
42. 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.
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 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 17 Lesson 3.


44. 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;
FROM players
WHERE position_id >= 6900
ORDER BY last_name DESC, first_name;

Correct.
45. Which statement about the default sort order is true? Mark for Review
(1) Points
The lowest numeric values are displayed last.
The earliest date values are displayed first. (*)
Null values are displayed first.
Character values are displayed in reverse alphabetical order.
Incorrect. See Section 17 Lesson 1.
46. 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.
Incorrect. See Section 17 Lesson 1.
47. Which comparison condition means ?Less Than or Equal To"? Mark for Revie
w
(1) Points
"=)"
"+<"
">="
"<=" (*)

Incorrect. See Section 17 Lesson 1.


48. 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.
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. Which logical operator returns TRUE if either condition is true? Mark fo
r Review
(1) Points
OR (*)
AND
NOT
BOTH
Correct.

Page 5 of 5

Vous aimerez peut-être aussi