Вы находитесь на странице: 1из 16

1.

Identify all of the incorrect statements that complete this sentence: A prim
ary 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

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

Correct

3. 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 (*)

Correct

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

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

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, an attribute becomes a _____________. Mark for


Review
(1) Points
Table

Foreign Key
Constraint
Column (*)

Correct

8. Attributes become tables in a database. True or False? Mark for Review


(1) Points
True
False (*)
Correct

9. 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 (*)

Correct

10. One-to-One relationships are transformed into Check Constraints in the ta


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

True
False (*)

Correct
11. When translating an arc relationship to a physical design, you must turn th
e arc relationships into foreign keys. Assuming you are implementing an Exclusiv
e Design, you must also create two Unique Key Constraints to ensure the Arc is i
mplemented correctly. True or False? Mark for Review
(1) Points
True
False (*)

Correct

Section 12
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. 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.

14. What command will return data from the database to you? Mark for Review
(1) Points

FETCH
GET
SELECT (*)
RETURN

Correct.

15. The SQL statement ALTER TABLE EMPLOYEES DELETE COLUMN SALARY is a valid s
tatement. True or False? Mark for Review
(1) Points
True
False (*)
21. 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.

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

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

24. 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.
Section 16
25. 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.

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

27. 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 (*)

Correct.

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

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

30. 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.
31. Which of the following commands will display the last name concatenated wit
h the job ID from the employees table, separated by a comma and space, and label
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;

Correct.

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

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

Incorrect. See Section 16 Lesson 2.

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

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

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

Correct

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

Correct.

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

Correct.

39. Which of the following are 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.

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

Correct.

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

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

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

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

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

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

Correct.

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

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

50. 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;
Correct.

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

Section 13
17. During which phases of the System Development Life Cycle would you test t
he system before rolling it out to the users? Mark for Review
(1) Points
Build and Transition
Strategy and Analysis
Design and Production

Transition and Production (*)

Correct.

18. Systems are always just rolled out as soon as the programming phase is fi
nished. No further work is required once the development is finished. True or Fa
lse? Mark for Review
(1) Points
True
False (*)
Correct.

Section 15
19. 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.

Incorrect. See Section 15 Lesson 1.

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

Correct.