You are on page 1of 21

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 or 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 access 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 your 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 tables
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+next_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 changing


terminology. Secondary Unique Identifiers become 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 for
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 primary
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
executed?
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 company. The
list should include the title of the album, the artist's name, and the 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 Oracle
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 justified.
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 letters 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 reside 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 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.
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
than 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 what order
you enter the values, i.e. BETWEEN low value AND high value will give the same result
as BETWEEN high value and low value. True or False? Mark for Review
(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 SELECT 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 default 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 50000.
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 none,
one or more characters? Mark for Review

(1) Points
_
% (*)
#
&
Correct.
36. Which comparison condition would you use to select rows that match a character
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 is in the
range from 25000 through 100000 and whose team id is in the range of 1200 through
1500. The results must be sorted by team id from lowest to highest and then further
sorted by salary from highest to lowest. Which statement should you 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 Review
(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 for 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 data is displayed in reverse alphabetical
order. Which keyword should you include in the ORDER BY
clause?
DESC (*)
ASC
SORT
CHANGE
Correct.

Mark for Review


(1) Points

44.Which clause would you include in a SELECT statement to


sort the rows returned by 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;

Mark for Review


(1) Points

You need to sort data by manager id values and then


alphabetically by employee last name and first name values.
Which ORDER BY clause could you use?
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?
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 left to right
The OR and AND conditions have the same precedence
and will be evaluated from right to left
Correct.

Mark for Review


(1) Points

47.Evaluate this SELECT statement:


SELECT *
FROM employees
WHERE department_id = 34
OR department_id = 45
OR department_id = 67;

Mark for Review


(1) Points

Which operator is the equivalent of the OR conditions used in


this SELECT statement?
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";

Mark for Review


(1) Points

This statement fails when executed. Which clause contains a


syntax error?
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?
SELECT employee_id, last_name, first_name, salary
'Yearly Salary' (*)

Mark for Review


(1) Points

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

Mark for Review


(1) Points

You might also like