You are on page 1of 21

Section 12

1. When mapping supertypes, relationships at the supertype level transform as usual.


Relationships at subtype level are implemented as foreign keys, but the foreign key
columns all become mandatory. True or False? Mark for Review
(1) Points

True

False (*)

Correct

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

3. It is possible to implement non-transferability via a simple Foreign Key Relationship.


True or False? Mark for Review
(1) Points

True

False (*)

Correct

4. Many to many relationships are implemented via a structure called a:


________________ Mark for Review
(1) Points

Supertype

Intersection Table (*)

Intersection Entity

Subtype

Incorrect. Refer to Section 12

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

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

7. A table must have a primary key. True or False? Mark for Review
(1) Points
True

False (*)

Correct

8. Identify all of the incorrect statements that complete this sentence: A primary 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 table

A set of columns in one table that uniquely identifies each row in another table (*)

Only one column that must be null (*)

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. Primary Unique Identifiers in the ER diagram become __________ and
relationships become ____________. Mark for Review
(1) Points
Foreign keys, Primary keys

Primary keys, Foreign keys (*)

Foreign keys, mandatory business rules

Unique Keys, Primary keys

Incorrect. Refer to Section 12

Section 12

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

Correct

Section 13

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

FETCH

GET

SELECT (*)

RETURN
Correct.

13. The DESCRIBE command returns all rows from a table. True or False? Mark for
Review
(1) Points

True

False (*)

Correct.

Section 16

14. Which SQL keyword specifies that an alias will be substituted for a column name in
the output of a SQL query? Mark for Review
(1) Points

AS (*)

OR

AND

SUBSTITUTE

Correct.

15. In a SQL statement, which clause specifies one or more columns to be returned 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 SELECT
statement.

Correct.

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

Correct.

17. When you use the SELECT clause to list one or two columns only from a table and
no WHERE clause, which SQL capability is used? Mark for Review
(1) Points

Joining only

Selection only

Projection only (*)

Projection and Selection

Correct.

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

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

20. In a SELECT clause, what is the result of 2 + 3 * 2? Mark for Review


(1) Points

8 (*)

10

13

Correct.

Section 16
21. 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 (*)

Correct

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

True (*)

False

Correct

Section 17

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


24. 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. See Section 17

25. 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
employee 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;

Correct.

26. 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. See Section 17

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

Correct.

28. Which operator is used to combine columns of character strings to other columns?
Mark for Review
(1) Points

|| (*)

Correct. See Section 17

29. Which comparison condition would you use to select rows that match a character
pattern? Mark for Review
(1) Points

IN

LIKE (*)

ALMOST

SIMILAR

Correct.

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

Section 17

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

32. Which symbol represents the not equal to condition? Mark for Review
(1) Points

'+'

!= (*)

Incorrect. See Section 17.

33. 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. See Section 17

34. The PRODUCT table contains these columns:


PRODUCT_ID NUMBER(9)
DESCRIPTION VARCHAR2(20)
COST NUMBER(5,2)
LOCATION_ID VARCHAR2(10)

You want to display product costs with these desired results: 1. The cost displayed for
each product is increased by 10 percent. 2. The product location id must be 4859, 9789,
or 9898. 3. Ten percent of the original cost is less than $10. Which statement should you
issue?
Mark for Review
(1) Points

SELECT product_id, cost * 1.10


FROM product
WHERE cost * .10 < 10.00
AND location_id IN (4859, 9789, 9898);
(*)

SELECT product_id, cost * .10


FROM product
WHERE cost * 1.10 > 10.00
AND location_id IN (4859, 9789, 9898);

SELECT product_id, cost * 1.10


FROM product
WHERE cost * 1.10 < 10.00
AND location_id = (4859, 9789, 9898);

SELECT product_id, cost * 1.10


FROM product
WHERE cost * .10 > 10.00
AND location_id = (4859, 9789, 9898);

Correct. See Section 17

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

Correct.

36. The EMPLOYEES table contains these columns:


EMPLOYEE_ID NUMBER(9) PrimaryKey
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
DEPARTMENT_ID NUMBER(5) NOT NULL
MANAGER_ID NUMBER(9) NOT NULL

Evaluate these two SELECT statements:


1. SELECT DISTINCT employee_id, department_id, manager_id FROM employees;
2. SELECT employee_id, department_id, manager_id FROM employees;

Which of the following statements is true?


Mark for Review
(1) Points

The two statements will display the same data. (*)

The first statement will display a particular DEPARTMENT_ID only once.

The first statement will NOT display values from all of the rows in the EMPLOYEES
table

The second statement could display a unique combination of the EMPLOYEE_ID,


MANAGER_ID, and DEPARTMENT_ID values more than once.
Correct. See Section 17

Section 18

37. Which logical operator returns TRUE if either condition is true? Mark for Review
(1) Points

OR (*)

AND

NOT

BOTH

Correct.

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

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

40. The ORDER BY clause always comes last. True or False? Mark for Review
(1) Points

True (*)

False

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

Correct.

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

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 want to display all players' names with position 6900 or greater. You want the
players names to be displayed alphabetically by last name and then by first name. 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
WHERE position_id >= 6900
ORDER BY last_name DESC, first_name;
Correct.

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

45. 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 database, 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.
46. 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.

47. 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 statement?
Mark for Review
(1) Points

IN (*)

AND

LIKE

BETWEEN ... AND ...

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

50

25 (*)

10

250 (*)

100

Correct.

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

50. Which SELECT statement should you use to limit the display of product
information 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.

You might also like