You are on page 1of 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 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 (*)
Incorrect. Refer to Section 12 Lesson 2.
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
Incorrect. Refer to Section 12 Lesson 2.
3. The DESCRIBE command returns all rows from a table. True or False? Mark f
or Review
(1) Points
True
False (*)

Incorrect. Refer to Section 12 Lesson 1.


4. 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.
5. The _______ clause can be added to a SELECT statement to return a subset o
f the data. Mark for Review
(1) Points
ANYWHERE
WHICH
WHERE (*)
EVERY
Incorrect. Refer to Section 12 Lesson 1.

Section 16
(Answer all questions in this section)
6. Which SELECT statement will display both unique and non-unique combination
s 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 16 Lesson 2.
7. You want to determine the orders that have been placed by customers who re
side 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.
8. 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.
9. You need to display all the employees whose last name starts with the lett
ers 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.
10. 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 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. 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.
12. 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.
13. You need to display employees with salaries that are at least 30000 or hi
gher. Which comparison operator should you use? Mark for Review
(1) Points
>
"=>"
>= (*)
!=
Incorrect. See Section 16 Lesson 1.
14. Which operator is used to combine columns of character strings to other c
olumns? Mark for Review
(1) Points
*
/
+
|| (*)
Incorrect. See Section 16 Lesson 1.
15. You need to display all the rows in the EMPLOYEES table that contain a nu
ll value in the DEPARTMENT_ID column. Which comparison operator should you use?
Mark for Review
(1) Points
"= NULL"
NULL!
ISNULL
IS NULL (*)
Incorrect. See Section 16 Lesson 1.

16. 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.
Incorrect. See Section 16 Lesson 1.
17. 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
Incorrect. See Section 16 Lesson 1.
18. 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;


SELECT last_name, hiredate, salary
FROM employees NATURAL JOIN salary
WHERE hiredate < '01-jan-00' AND salary > 50000;
(*)
SELECT last_name, hiredate, salary
FROM employees (+) salary
WHERE hiredate < '01-jan-00' AND salary > 50000;

Incorrect. See Section 16 Lesson 3.

Section 17
(Answer all questions in this section)
19. The ORDER BY clause always comes last. True or False? Mark for Review
(1) Points
True (*)
False
Correct.
20. 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.

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 17
(Answer all questions in this section)
21. 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.
22. Which logical operator returns TRUE if either condition is true? Mark fo
r Review
(1) Points
OR (*)
AND
NOT
BOTH
Correct.
23. 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.

24. 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.
25. 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. (*)
Incorrect! See Section 17 Lesson 2.
26. 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 17 Lesson 2.
27. 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.
28. 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.
29. 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.
30. 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.

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 17
(Answer all questions in this section)
31. 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.
Incorrect! See Section 17 Lesson 3.
32. 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.

33. 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.

Section 11
(Answer all questions in this section)
34. When translating an arc relationship to a physical design, you must turn
the arc relationships into foreign keys. Assuming you are implementing an Exclus
ive Design, you must also create two Unique Key Constraints to ensure the Arc is

implemented correctly. True or False? Mark for Review


(1) Points
True
False (*)
Incorrect. Refer to Section 11 Lesson 4.
35. 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.
36. 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.
37. Why would this table name NOT work in an Oracle database? this_year_end+n
ext_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
Incorrect. Refer to Section 11 Lesson 2.

38. 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
39. 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 11 Lesson 1.
40. 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

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 11
(Answer all questions in this section)
41. 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.
42. 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
User-defined integrity (*)
Column integrity
Referential integrity
Incorrect. Refer to Section 11 Lesson 1.
43. 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 (*)
Incorrect. Refer to Section 11 Lesson 1.

Section 15
(Answer all questions in this section)
44. 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.
45. 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;

Correct.
46. 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
Incorrect. See Section 15 Lesson 1.
47. 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.
48. 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.
49. 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.
50. Which statement best describes how arithmetic expressions are handled? M
ark for Review
(1) Points
Addition operations are handled before any other operations.
Multiplication and subtraction operations are handled before any other opera
tions.
Multiplication and addition operations are handled before subtraction and di
vision operations.
Division and multiplication operations are handled before subtraction and ad
dition operations. (*)
Incorrect. See Section 15 Lesson 1.

Page 5 of 5

You might also like