Professional Documents
Culture Documents
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)
1. The SQL statement ALTER TABLE EMPLOYEES DELETE COLUMN SALARY is a valid st
atement. True or False? Mark for Review
(1) Points
True
False (*)
Correct.
2. 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
Correct.
3. 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 (*)
Correct.
4. What command will return data from the database to you? Mark for Review
(1) Points
FETCH
GET
SELECT (*)
RETURN
Correct.
5. The DESCRIBE command returns all rows from a table. True or False? Mark f
or Review
(1) Points
True
False (*)
Correct.
Section 11
(Answer all questions in this section)
6. 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
7. The transformation from an ER diagram to a physical design involves changi
ng terminology. Secondary Unique Identifiers become Mark for Review
(1) Points
Columns
Tables
Unique Constraints (*)
Page 1 of 5
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)
11. 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
12. 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 (*)
Correct
13. The text below is an example of what constraint type:
If the number of BOOKS lent to a BORROWER in the LIBRARY exceeds 5, then we must
send him/her a letter requesting the return of the BOOKS, which will require ex
tra programming to enforce.
Mark for Review
(1) Points
Entity integrity
Section 15
(Answer all questions in this section)
16. In the default order of precedence, which operator would be evaluated fir
st? Mark for Review
(1) Points
Subtractions and Addition are at the same level and would be evaluated first
based on left to right order
Multiplications and Division are at the same level and would be evaluated fi
rst based on left to right order (*)
Additions and Multiplications are at the same level and would be evaluated f
irst based on left to right order
Divisions and Subtractions are at the same level and would be evaluated firs
t based on left to right order
Correct.
17. In which clause of a SELECT statement would you specify the name of the t
able 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.
18. If a SQL statement returns data from two or more tables, which SQL capabi
lity is being used? Mark for Review
(1) Points
Selection
Projection
Joining (*)
Insertion
Correct.
19. 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.
Page 2 of 5
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)
21. 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.
Section 17
(Answer all questions in this section)
23. 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.
24. 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.
25. Which comparison condition means "Less Than or Equal To"? Mark for Revie
w
(1) Points
"=)"
"+<"
">="
"<=" (*)
Incorrect. See Section 17 Lesson 1.
26. Which logical operator returns TRUE if either condition is true? Mark fo
r Review
(1) Points
OR (*)
AND
NOT
BOTH
Correct.
27. 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.
28. 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.
Correct.
29. You attempt to query the database with this SQL statement:
SELECT product_id "Product Number", category_id "Category", price "Price"
FROM products
Page 3 of 5
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)
Correct.
36. 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
Correct.
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.
Section 16
(Answer all questions in this section)
38. Where in a SQL statement can you not use arithmetic operators? Mark for
Review
(1) Points
SELECT
FROM (*)
WHERE
NONE
Correct.
39. When using the LIKE condition, which symbol represents any sequence of no
ne, one or more characters? Mark for Review
(1) Points
_
% (*)
#
&
Correct.
40. Which operator is used to combine columns of character strings to other c
olumns? Mark for Review
(1) Points
*
/
+
|| (*)
Correct.
Page 4 of 5
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)
41. When using the LIKE condition to search for _ symbols, which character ca
n you use as the default ESCAPE option? Mark for Review
(1) Points
%
^
&
\ (*)
Correct.
42. 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.
43. Which symbol represents the not equal to condition? Mark for Review
(1) Points
#
+'
!= (*)
~
Correct.
44. 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
UNIQUEONE
DISTINCT (*)
DISTINCTROW
Correct.
45. 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_'
Correct.
46. 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.
47. What will be the result of the SELECT statement and what will display?
SELECT last_name, salary, salary + 300
FROM employees;
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.
48. 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.
49. 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;
Correct.
50. You want to create a report that displays all employees who were hired be
fore January 1, 2000 and whose annual salaries are greater than 50000.
The EMPLOYEES table contains these columns:
EMPLOYEE_ID VARCHAR2(5) PRIMARY KEY
LAST_NAME VARCHAR2(35)
HIREDATE DATE
DEPARTMENT_ID NUMBER(4)
The SALARY table contains these columns:
SALARYID VARCHAR2(5) PRIMARY KEY
SALARY NUMBER(5, 2)
EMPLOYEE_ID VARCHAR2(5) FOREIGN KEY
Which query should you issue?
Mark for Review
(1) Points
SELECT last_name, hiredate, salary
FROM employees NATURAL JOIN salary USING employee_id
WHERE hiredate < 01-jan-00 AND salary > 50000;
SELECT last_name, hiredate, salary
FROM employees JOIN salary
ON employee_id = employee_id
WHERE hiredate < '01-jan-00' AND salary > 50000;
Correct.
Page 5 of 5