260
Section 12 Lesson 1(Answer all questions in this section) 1. A table must have at least one candidate key, as well as its primary key. True or False? True False 2. Foreign keys must be null. True or False? True False 3. 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 extra programming to enforce. Entity integrity User- defined integrity Column integrity Referential integrity 4. 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? True False Section 12 Lesson 2(Answer all questions in this section) 5. Attributes become tables in a database. True or False? True False 6. Why would this table name NOT work in an Oracle database? This_year_end+next_year Table names must begin with an alphabetic character Too long The Plus sign + is not allowed in object names None of the above This watermark does not appear in the registered version - http://www.clicktoconvert.com

finalkit

Embed Size (px)

Citation preview

Page 1: finalkit

Section 12 Lesson 1(Answer all questions in this section) 1. A table must have at least

one candidate key, as well as its primary key. True or False?

True

False

2. Foreign keys must be null. True or False?

True

False

3. 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 extra programming to enforce.

Entity integrity

User-defined integrity

Column integrity

Referential integrity

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

True

False

Section 12 Lesson 2(Answer all questions in this section) 5. Attributes become tables in a database. True or False?

True

False

6. Why would this table name NOT work in an Oracle database?

This_year_end+next_year

Table names must begin with an alphabetic character

Too long

The Plus sign + is not allowed in object names

None of the above

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 2: finalkit

7. In a physical data model, a relationship is represented as a combination of: (Choose

Two) (Choose all correct answers)

Column

Primary Key or Unique Key

Check Constraint or Unique Key

Foreign Key

Section 12 Lesson 3(Answer all questions in this section) 8. The Oracle Database can implement a many to many relationship. You simple create two foreign keys

between the two tables. True or False?

True

False

9. What do you create when you transform a many to many relationship from your ER

diagram into a physical design?

Unique key constraints

Intersection entity

Intersection table

Two tables with a Foreign key constraints between them

Section 12 Lesson 4(Answer all questions in this section) 10. When translating an arc relationship to a physical design, you must turn the arc relationships into foreign keys. Assuming you are implementing an Exclusive Design, you must also create two

Unique Key Constraints to ensure the Arc is implemented correctly. True or False?

True

False

Section 12 Lesson 4(Answer all questions in this section) 11. 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?

True

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 3: finalkit

False

Section 13 Lesson 1(Answer all questions in this section) 12. What

command will return data from the database to you?

FETCH

GET

SELECT

RETURN

13. The _______ clause can be added to a select statement to return a subset of the

data.

ANYWHERE

WHICH

WHERE

EVERY

Section 16 Lesson 1(Answer all questions in this section) 14. 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?

SELECT * FROM albums;

SELECT alb_title, alb_artist, alb_dates FROM album;

SELECT * FROM album;

SELECT alb_title; alb_artist; alb_date FROM albums;

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 4: finalkit

15. In the default order of precedence, which operator would be evaluated first?

Subtractions

Multiplications

Additions

Divisions

16. Evaluate this SELECT statement:

SELECT (salary * raise_percent) raise FROM employees;

If the RAISE_PERCENT column only contains null values, what will the statement return?

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

17. What would you use in the SELECT clause to return all the columns in the table?

an asterisk (*)

a minus sign (-)

a plus sign (+)

the ALL keyword

18. The SELECT statement retrieves information from the database. In a SELECT

statement, you can do all of the following EXCEPT:

Projection

Manipulation

Joining

Selection

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 5: finalkit

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?

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.

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

Joining only

Selection only

Projection only

Projection and Selection

Section 16 Lesson 3(Answer all questions in this section) 21. In a SELECT statement

Additions are evaluated before Multiplications. True or False?

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 6: finalkit

True

False

22. All computers in the world speaks the same languages, so you only need to learn one

programming language - Oracle SQL. True or False?

True

False

Section 17 Lesson 1(Answer all questions in this section) 23. Which statement best describes how column headings are displayed by default in Oracle Application

Express:

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.

24. You need to display employees with salaries that are at least 30000 or higher. Which

comparison operator should you use?

>

"=>"

>=

!=

25. The Concatenation Operator does which of the following?

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.

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

ONLY

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 7: finalkit

UNIQUE

DISTINCT

DISTINCTROW

27. What does the DISTINCT keyword do when it is used in a SELECT clause?

Mark for Review (1) Points

Hides NULL values

Eliminates all unique values and compares values

Eliminates duplicate rows in the result

Eliminates only unique rows in the result

28. You need to display employees whose salary is in the range of 10000 through 25000

for employees in department 50 . What does the WHERE clause look like?

WHERE department_id < 50 AND salary BETWEEN 10000 AND 25000

WHERE department_id > 50 AND salary BETWEEN 10000 AND 25000

WHERE department_id = 50 AND salary BETWEEN 25001 AND 10001

WHERE department_id = 50 AND salary BETWEEN 25000 AND 10000

Section 17 Lesson 2(Answer all questions in this section) 29. 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?

The ESCAPE option (\) and one or more percent signs (%)

The (+) operator

A percent sign (%)

The ESCAPE option (\)

30. Evaluate this SQL statement:

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 8: finalkit

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?

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.

Section 17 Lesson 2(Answer all questions in this section) 31. Which SELECT

statement will display both unique and non-unique combinations of the MANAGER_ID

and DEPARTMENT_ID values from the EMPLOYEES table?

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;

32. You want to determine the orders that have been placed by customers who live 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?

AND city = Chicago;

AND city = 'Chicago';

WHERE city = 'Chicago';

WHERE city = Chicago;

33. The PLAYERS table contains these columns: PLAYER_ID NUMBER (9) Primary Key

LAST_NAME VARCHAR2 (20) FIRST_NAME VARCHAR2 (20)

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 9: finalkit

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?

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;

Section 17 Lesson 3(Answer all questions in this section) 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?

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

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 10: finalkit

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

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

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 EMPLOYEE table

The second statement could display a unique combination of the EMPLOYEE_ID, MANAGER_ID, and DEPARTMENT_ID values more than once.

36. The EMPLOYEES table includes these columns: EMPLOYEE_ID NUMBER(4) NOT NULL

LAST_NAME VARCHAR2(15) NOT NULL FIRST_NAME VARCHAR2(10) NOT NULL HIRE_DATE DATE NOT NULL

You want to produce a report that provides the first names, last names and hire dates of those employees who were hired between March 1, 2000, and August 30, 2000. Which statements can you issue to accomplish this task?

SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '01-MAR-00' AND '30-AUG-00';

SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '30-AUG-00' AND '01-MAR-00';

SELECT last_name, first_name, hire_date FROM employees GROUP BY hire_date >= '01-MAR-00' and hire_date <= '30- AUG-00';

SELECT last_name, first_name, hire_date FROM employees AND hire_date >= '01-MAR-00' and hire_date <= '30-AUG- 00';

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 11: finalkit

Section 18 Lesson 1(Answer all questions in this section) 37. 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

38. Which clause would you include in a SELECT statement to sort the rows

returned by the LAST_NAME column?

ORDER BY

WHERE

FROM

HAVING

39. Which statement about the logical operators is true?

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.

40. You need to replace null values in the DEPARTMENT_ID column with a

zero (0). Which function should you use?

NVL

NULL

NULLIF

REPLACE

Section 18 Lesson 1(Answer all questions in this section) 41. Which logical operator

returns TRUE if either condition is true?

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 12: finalkit

OR

AND

NOT

BOTH

42. The ORDER BY clause always comes last. True or False?

True

False

Section 18 Lesson 2(Answer all questions in this section) 43. 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

44. Evaluate this SELECT statement:

SELECT last_name, first_name, salary FROM employees;

How will the results of this query be sorted?

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.

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 13: finalkit

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.

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?

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.

46. Evaluate this SELECT statement:

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

Which operator is the same as the OR conditions used in this SELECT statement?

IN

AND

LIKE

BETWEEN ... AND ...

47. You need to create a report to display all employees that were hired on or before 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?

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 14: finalkit

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';

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

(Choose all correct answers)

1

50

25

10

250

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 15: finalkit

100

Section 18 Lesson 3(Answer all questions in this section) 49. 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?

Reorder the clauses in the query.

Remove the tables aliases in the WHERE clause.

Remove the table aliases in the ORDER BY clause.

Include a HAVING clause.

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

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

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 16: finalkit

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;

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 17: finalkit

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

True

False

2. A table must have at least one candidate key, as well as its primary key. True or

False?

True

False

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

True

False

4. A foreign key can not refer to a primary key in the same table. True or False?

Mark for Review (1) Points

True

False

Section 12 Lesson 2(Answer all questions in this section) 5. In a

physical data model, a relationship is represented as a combination of: (Choose Two) (Choose all correct answers)

Column

Primary Key or Unique Key

Check Constraint or Unique Key

Foreign Key

6. In an Oracle database, why would 1_TABLE not work as a table name?

The database does not understand all capital letters

There is no problem here. You can create a table called 1_TABLE

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 18: finalkit

Object names must not start with a number. They must begin with a letter

TABLE is a reserved word

7. Attributes become tables in a database. True or False?

True

False

Section 12 Lesson 3(Answer all questions in this section) 8. The Oracle Database can implement a many to many relationship. You simple create two foreign keys

between the two tables. True or False? Mark for Review (1) Points

True

False

9. What do you create when you transform a many to many relationship from your ER

diagram into a physical design?

Unique key constraints

Intersection entity

Intersection table

Two tables with a Foreign key constraints between them

Section 12 Lesson 4(Answer all questions in this section) 10. An "Arc Implementation" can be done just like any other Relationship - you simply add the required

Foreign Keys. True or False?

True

False

Section 12 Lesson 4(Answer all questions in this section) 11. When translating an arc relationship to a physical design, you must turn the arc relationships into foreign keys. Assuming you are implementing an Exclusive Design, you must also create two Unique Key Constraints to

ensure the Arc is implemented correctly. True or False?

True

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 19: finalkit

False

Section 13 Lesson 1(Answer all questions in this section) 12. What

command can used to create a new row in a table in the database?

CREATE

NEW

ADD

INSERT

13. What command will return data from the database to you?

FETCH

GET

SELECT

RETURN

Section 16 Lesson 1(Answer all questions in this section) 14. Which SQL keyword specifies that an alias will be substituted for a column name in the output of a SQL

query?

AS

OR

AND

SUBSTITUTE

15. In the default order of precedence, which operator would be evaluated first?

Subtractions

Multiplications

Additions

Divisions

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 20: finalkit

16. Which statement best describes how arithmetic expressions are handled?

Addition operations are handled before any other operations.

Multiplication and substraction operations are handled before any other operations.

Multiplication and addition operations are handled before subtraction and division operations.

Division and multiplication operations are handled before subtraction and addition operations.

17. You query the database with this SQL statement: SELECT * FROM students;

Why would you use this statement?

To insert data

To view data

To display the table structure

To delete data

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

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 21: finalkit

What will be the result?

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.

19. Which keyword can be used to specify a column alias?

AS

DESCRIBE

FROM

WHERE

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

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

Section 16 Lesson 3(Answer all questions in this section) 21. There is only one kind of

software used by all computers. True or Fale?

True

False

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 22: finalkit

22. All computers in the world speaks the same languages, so you only need to learn one

programming language - Oracle SQL. True or False?

True

False

Section 17 Lesson 1(Answer all questions in this section) 23. Which clause would you include in a SELECT statement to restrict the data returned to only the

employees in department 10?

WHERE

FROM

SELECT

IS

24. When using the LIKE condition, which symbol represents any sequence of none,

one or more characters?

_

%

#

&

25. Which comparison condition would you use to select rows that match a character

pattern?

IN

LIKE

ALMOST

SIMILAR

26. Which of the following elements cannot be included in a WHERE clause?

A column alias

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 23: finalkit

A column name

A comparison condition

A constant

27. Which operator is used to combine columns of character strings to other columns?

*

/

+

||

28. You need to display all the rows in the EMPLOYEES table that contain a null value

in the DEPARTMENT_ID column. Which comparison operator should you use?

"= NULL"

NULL!

ISNULL

IS NULL

Section 17 Lesson 2(Answer all questions in this section) 29. 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?

%

~

#

*

30. You want to retrieve a list of customers whose last names begin with the letters Fr . Which keyword should you include in the WHERE clause of your SELECT statement to achieve

the desired result?

AND

IN

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 24: finalkit

BETWEEN

LIKE

Section 17 Lesson 2(Answer all questions in this section) 31. What will the result of the following SELECT statement be:

SELECT last_name, salary, salary + 300 FROM employees;

Display the last name, salary and the results of adding 300 to each salary for 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 the new salary.

Display the last name, salary and the results of adding 300 to the salary of the first employee row

32. Which of the following commands will display the last name concatenated with the job ID from the employees table, separated by a comma and space, and label the resulting column "Employee and Title"?

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;

33. The PLAYERS table contains these columns:

PLAYER_ID NUMBER (9) Primary Key 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?

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 25: finalkit

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;

Section 17 Lesson 3(Answer all questions in this section) 34. 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?

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 EMPLOYEE table

The second statement could display a unique combination of the EMPLOYEE_ID, MANAGER_ID, and DEPARTMENT_ID values more than once.

35. You want to create a report that displays all employees who were hired before 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) HIRE_DATE DATE DEPARTMENT_ID NUMBER(4)

The SALARY table contains these columns:

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 26: finalkit

SALARY_ID VARCHAR2(5) PRIMARY KEY SALARY NUMBER(5, 2) EMPLOYEE_ID VARCHAR2(5) FOREIGN KEY

Which query should you issue?

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;

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

True

False

Section 18 Lesson 1(Answer all questions in this section) 37. Which

statement about the ORDER BY clause is true?

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

38. Which logical operator returns TRUE if either condition is true?

OR

AND

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 27: finalkit

NOT

BOTH

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

40. Which of the following are TRUE regarding the logical AND operator?

TRUE AND TRUE return FALSE

TRUE AND FALSE return TRUE

FALSE AND TRUE return NULL

TRUE AND FALSE return FALSE

Section 18 Lesson 1(Answer all questions in this section) 41. The ORDER BY clause

always comes last. True or False?

True

False

42. Which of the following best describes the meaning of the LIKE operator?

Display rows based on a range of values.

To test for values in a list.

Match a character pattern.

To find Null values.

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 28: finalkit

Section 18 Lesson 2(Answer all questions in this section) 43. 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

44. Evaluate this SELECT statement:

SELECT last_name, first_name, salary FROM employees;

How will the results of this query be sorted?

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.

45. Evaluate this SELECT statement:

SELECT last_name, first_name, department_id, manager_id FROM employees;

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?

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 29: finalkit

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

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?

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.

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

FROM employees

WHERE salary IS NOT NULL

ORDER BY last_name, 3;

48. Evaluate this SELECT statement:

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 30: finalkit

SELECT first_name, last_name, email FROM employees ORDER BY last_name;

Which statement is true?

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

The rows will be sorted alphabetically by the FIRST_NAME and then the LAST_NAME values

Section 18 Lesson 3(Answer all questions in this section) 49. 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?

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

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 31: finalkit

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;

50. The EMPLOYEES table contains these columns:

EMPLOYEE_ID NUMBER(9) Primary Key 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?

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.

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 32: finalkit

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

True

False

2. A table must have at least one candidate key, as well as its primary key. True or

False?

True

False

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

True

False

4. A foreign key can not refer to a primary key in the same table. True or False?

Mark for Review (1) Points

True

False

Section 12 Lesson 2(Answer all questions in this section) 5. In a

physical data model, a relationship is represented as a combination of: (Choose Two) (Choose all correct answers)

Column

Primary Key or Unique Key

Check Constraint or Unique Key

Foreign Key

6. In an Oracle database, why would 1_TABLE not work as a table name?

The database does not understand all capital letters

There is no problem here. You can create a table called 1_TABLE

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 33: finalkit

Object names must not start with a number. They must begin with a letter

TABLE is a reserved word

7. Attributes become tables in a database. True or False?

True

False

Section 12 Lesson 3(Answer all questions in this section) 8. The Oracle Database can implement a many to many relationship. You simple create two foreign keys

between the two tables. True or False? Mark for Review (1) Points

True

False

9. What do you create when you transform a many to many relationship from your ER

diagram into a physical design?

Unique key constraints

Intersection entity

Intersection table

Two tables with a Foreign key constraints between them

Section 12 Lesson 4(Answer all questions in this section) 10. An "Arc Implementation" can be done just like any other Relationship - you simply add the required

Foreign Keys. True or False?

True

False

Section 12 Lesson 4(Answer all questions in this section) 11. When translating an arc relationship to a physical design, you must turn the arc relationships into foreign keys. Assuming you are implementing an Exclusive Design, you must also create two Unique Key Constraints to

ensure the Arc is implemented correctly. True or False?

True

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 34: finalkit

False

Section 13 Lesson 1(Answer all questions in this section) 12. What

command can used to create a new row in a table in the database?

CREATE

NEW

ADD

INSERT

13. What command will return data from the database to you?

FETCH

GET

SELECT

RETURN

Section 16 Lesson 1(Answer all questions in this section) 14. Which SQL keyword specifies that an alias will be substituted for a column name in the output of a SQL

query?

AS

OR

AND

SUBSTITUTE

15. In the default order of precedence, which operator would be evaluated first?

Subtractions

Multiplications

Additions

Divisions

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 35: finalkit

16. Which statement best describes how arithmetic expressions are handled?

Addition operations are handled before any other operations.

Multiplication and substraction operations are handled before any other operations.

Multiplication and addition operations are handled before subtraction and division operations.

Division and multiplication operations are handled before subtraction and addition operations.

17. You query the database with this SQL statement: SELECT * FROM students;

Why would you use this statement?

To insert data

To view data

To display the table structure

To delete data

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

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 36: finalkit

What will be the result?

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.

19. Which keyword can be used to specify a column alias?

AS

DESCRIBE

FROM

WHERE

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

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

Section 16 Lesson 3(Answer all questions in this section) 21. There is only one kind of

software used by all computers. True or Fale?

True

False

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 37: finalkit

22. All computers in the world speaks the same languages, so you only need to learn one

programming language - Oracle SQL. True or False?

True

False

Section 17 Lesson 1(Answer all questions in this section) 23. Which clause would you include in a SELECT statement to restrict the data returned to only the

employees in department 10?

WHERE

FROM

SELECT

IS

24. When using the LIKE condition, which symbol represents any sequence of none,

one or more characters?

_

%

#

&

25. Which comparison condition would you use to select rows that match a character

pattern?

IN

LIKE

ALMOST

SIMILAR

26. Which of the following elements cannot be included in a WHERE clause?

A column alias

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 38: finalkit

A column name

A comparison condition

A constant

27. Which operator is used to combine columns of character strings to other columns?

*

/

+

||

28. You need to display all the rows in the EMPLOYEES table that contain a null value

in the DEPARTMENT_ID column. Which comparison operator should you use?

"= NULL"

NULL!

ISNULL

IS NULL

Section 17 Lesson 2(Answer all questions in this section) 29. 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?

%

~

#

*

30. You want to retrieve a list of customers whose last names begin with the letters Fr . Which keyword should you include in the WHERE clause of your SELECT statement to achieve

the desired result?

AND

IN

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 39: finalkit

BETWEEN

LIKE

Section 17 Lesson 2(Answer all questions in this section) 31. What will the result of the following SELECT statement be:

SELECT last_name, salary, salary + 300 FROM employees;

Display the last name, salary and the results of adding 300 to each salary for 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 the new salary.

Display the last name, salary and the results of adding 300 to the salary of the first employee row

32. Which of the following commands will display the last name concatenated with the job ID from the employees table, separated by a comma and space, and label the resulting column "Employee and Title"?

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;

33. The PLAYERS table contains these columns:

PLAYER_ID NUMBER (9) Primary Key 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?

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 40: finalkit

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;

Section 17 Lesson 3(Answer all questions in this section) 34. 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?

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 EMPLOYEE table

The second statement could display a unique combination of the EMPLOYEE_ID, MANAGER_ID, and DEPARTMENT_ID values more than once.

35. You want to create a report that displays all employees who were hired before 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) HIRE_DATE DATE DEPARTMENT_ID NUMBER(4)

The SALARY table contains these columns:

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 41: finalkit

SALARY_ID VARCHAR2(5) PRIMARY KEY SALARY NUMBER(5, 2) EMPLOYEE_ID VARCHAR2(5) FOREIGN KEY

Which query should you issue?

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;

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

True

False

Section 18 Lesson 1(Answer all questions in this section) 37. Which

statement about the ORDER BY clause is true?

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

38. Which logical operator returns TRUE if either condition is true?

OR

AND

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 42: finalkit

NOT

BOTH

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

40. Which of the following are TRUE regarding the logical AND operator?

TRUE AND TRUE return FALSE

TRUE AND FALSE return TRUE

FALSE AND TRUE return NULL

TRUE AND FALSE return FALSE

Section 18 Lesson 1(Answer all questions in this section) 41. The ORDER BY clause

always comes last. True or False?

True

False

42. Which of the following best describes the meaning of the LIKE operator?

Display rows based on a range of values.

To test for values in a list.

Match a character pattern.

To find Null values.

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 43: finalkit

Section 18 Lesson 2(Answer all questions in this section) 43. 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

44. Evaluate this SELECT statement:

SELECT last_name, first_name, salary FROM employees;

How will the results of this query be sorted?

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.

45. Evaluate this SELECT statement:

SELECT last_name, first_name, department_id, manager_id FROM employees;

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?

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 44: finalkit

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

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?

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.

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

FROM employees

WHERE salary IS NOT NULL

ORDER BY last_name, 3;

48. Evaluate this SELECT statement:

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 45: finalkit

SELECT first_name, last_name, email FROM employees ORDER BY last_name;

Which statement is true?

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

The rows will be sorted alphabetically by the FIRST_NAME and then the LAST_NAME values

Section 18 Lesson 3(Answer all questions in this section) 49. 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?

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

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 46: finalkit

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;

50. The EMPLOYEES table contains these columns:

EMPLOYEE_ID NUMBER(9) Primary Key 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?

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.

Section 12 Lesson 1(Answer all questions in this section) 1. A table must have at least

one candidate key, as well as its primary key. True or False?

True

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 47: finalkit

False

2. Foreign keys must be null. True or False?

True

False

3. 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 extra programming to enforce.

Entity integrity

User-defined integrity

Column integrity

Referential integrity

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

True

False

Section 12 Lesson 2(Answer all questions in this section) 5. Attributes become tables in a database. True or False?

True

False

6. Why would this table name NOT work in an Oracle database?

This_year_end+next_year

Table names must begin with an alphabetic character

Too long

The Plus sign + is not allowed in object names

None of the above

7. In a physical data model, a relationship is represented as a combination of: (Choose

Two) (Choose all correct answers)

Column

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 48: finalkit

Primary Key or Unique Key

Check Constraint or Unique Key

Foreign Key

Section 12 Lesson 3(Answer all questions in this section) 8. The Oracle Database can implement a many to many relationship. You simple create two foreign keys

between the two tables. True or False?

True

False

9. What do you create when you transform a many to many relationship from your ER

diagram into a physical design?

Unique key constraints

Intersection entity

Intersection table

Two tables with a Foreign key constraints between them

Section 12 Lesson 4(Answer all questions in this section) 10. When translating an arc relationship to a physical design, you must turn the arc relationships into foreign keys. Assuming you are implementing an Exclusive Design, you must also create two

Unique Key Constraints to ensure the Arc is implemented correctly. True or False?

True

False

Section 12 Lesson 4(Answer all questions in this section) 11. 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?

True

False

Section 13 Lesson 1(Answer all questions in this section) 12. What

command will return data from the database to you?

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 49: finalkit

FETCH

GET

SELECT

RETURN

13. The _______ clause can be added to a select statement to return a subset of the

data.

ANYWHERE

WHICH

WHERE

EVERY

Section 16 Lesson 1(Answer all questions in this section) 14. 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?

SELECT * FROM albums;

SELECT alb_title, alb_artist, alb_dates FROM album;

SELECT * FROM album;

SELECT alb_title; alb_artist; alb_date FROM albums;

15. In the default order of precedence, which operator would be evaluated first?

Subtractions

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 50: finalkit

Multiplications

Additions

Divisions

16. Evaluate this SELECT statement:

SELECT (salary * raise_percent) raise FROM employees;

If the RAISE_PERCENT column only contains null values, what will the statement return?

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

17. What would you use in the SELECT clause to return all the columns in the table?

an asterisk (*)

a minus sign (-)

a plus sign (+)

the ALL keyword

18. The SELECT statement retrieves information from the database. In a SELECT

statement, you can do all of the following EXCEPT:

Projection

Manipulation

Joining

Selection

19. The EMPLOYEES table contains these columns:

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 51: finalkit

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?

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.

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

Joining only

Selection only

Projection only

Projection and Selection

Section 16 Lesson 3(Answer all questions in this section) 21. In a SELECT statement

Additions are evaluated before Multiplications. True or False?

True

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 52: finalkit

False

22. All computers in the world speaks the same languages, so you only need to learn one

programming language - Oracle SQL. True or False?

True

False

Section 17 Lesson 1(Answer all questions in this section) 23. Which statement best describes how column headings are displayed by default in Oracle Application

Express:

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.

24. You need to display employees with salaries that are at least 30000 or higher. Which

comparison operator should you use?

>

"=>"

>=

!=

25. The Concatenation Operator does which of the following?

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.

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

ONLY

UNIQUE

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 53: finalkit

DISTINCT

DISTINCTROW

27. What does the DISTINCT keyword do when it is used in a SELECT clause?

Mark for Review (1) Points

Hides NULL values

Eliminates all unique values and compares values

Eliminates duplicate rows in the result

Eliminates only unique rows in the result

28. You need to display employees whose salary is in the range of 10000 through 25000

for employees in department 50 . What does the WHERE clause look like?

WHERE department_id < 50 AND salary BETWEEN 10000 AND 25000

WHERE department_id > 50 AND salary BETWEEN 10000 AND 25000

WHERE department_id = 50 AND salary BETWEEN 25001 AND 10001

WHERE department_id = 50 AND salary BETWEEN 25000 AND 10000

Section 17 Lesson 2(Answer all questions in this section) 29. 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?

The ESCAPE option (\) and one or more percent signs (%)

The (+) operator

A percent sign (%)

The ESCAPE option (\)

30. Evaluate this SQL statement:

SELECT last_name, first_name, salary FROM employees;

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 54: finalkit

How will the heading for the SALARY column appear in the display by default in Oracle Application Express?

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.

Section 17 Lesson 2(Answer all questions in this section) 31. Which SELECT

statement will display both unique and non-unique combinations of the MANAGER_ID

and DEPARTMENT_ID values from the EMPLOYEES table?

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;

32. You want to determine the orders that have been placed by customers who live 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?

AND city = Chicago;

AND city = 'Chicago';

WHERE city = 'Chicago';

WHERE city = Chicago;

33. The PLAYERS table contains these columns: PLAYER_ID NUMBER (9) Primary Key

LAST_NAME VARCHAR2 (20) FIRST_NAME VARCHAR2 (20) TEAM_ID NUMBER (4) MANAGER_ID NUMBER (9) POSITION_ID NUMBER (4)

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 55: finalkit

Which SELECT statement should you use if you want to display unique combinations of the TEAM_ID and MANAGER_ID columns?

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;

Section 17 Lesson 3(Answer all questions in this section) 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?

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);

35. The EMPLOYEES table contains these columns:

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 56: finalkit

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?

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 EMPLOYEE table

The second statement could display a unique combination of the EMPLOYEE_ID, MANAGER_ID, and DEPARTMENT_ID values more than once.

36. The EMPLOYEES table includes these columns: EMPLOYEE_ID NUMBER(4) NOT NULL

LAST_NAME VARCHAR2(15) NOT NULL FIRST_NAME VARCHAR2(10) NOT NULL HIRE_DATE DATE NOT NULL

You want to produce a report that provides the first names, last names and hire dates of those employees who were hired between March 1, 2000, and August 30, 2000. Which statements can you issue to accomplish this task?

SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '01-MAR-00' AND '30-AUG-00';

SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '30-AUG-00' AND '01-MAR-00';

SELECT last_name, first_name, hire_date FROM employees GROUP BY hire_date >= '01-MAR-00' and hire_date <= '30- AUG-00';

SELECT last_name, first_name, hire_date FROM employees AND hire_date >= '01-MAR-00' and hire_date <= '30-AUG- 00';

Section 18 Lesson 1(Answer all questions in this section) 37. You need to change the default sort order of the ORDER BY clause so that the data is

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 57: finalkit

displayed in reverse alphabetical order. Which keyword should you include in the

ORDER BY clause?

DESC

ASC

SORT

CHANGE

38. Which clause would you include in a SELECT statement to sort the rows

returned by the LAST_NAME column?

ORDER BY

WHERE

FROM

HAVING

39. Which statement about the logical operators is true?

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.

40. You need to replace null values in the DEPARTMENT_ID column with a

zero (0). Which function should you use?

NVL

NULL

NULLIF

REPLACE

Section 18 Lesson 1(Answer all questions in this section) 41. Which logical operator

returns TRUE if either condition is true?

OR

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 58: finalkit

AND

NOT

BOTH

42. The ORDER BY clause always comes last. True or False?

True

False

Section 18 Lesson 2(Answer all questions in this section) 43. 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

44. Evaluate this SELECT statement:

SELECT last_name, first_name, salary FROM employees;

How will the results of this query be sorted?

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.

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 59: finalkit

The results will be sorted ascending by LAST_NAME, FIRST_NAME, and SALARY.

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?

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.

46. Evaluate this SELECT statement:

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

Which operator is the same as the OR conditions used in this SELECT statement?

IN

AND

LIKE

BETWEEN ... AND ...

47. You need to create a report to display all employees that were hired on or before 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?

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 60: finalkit

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';

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

(Choose all correct answers)

1

50

25

10

250

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 61: finalkit

100

Section 18 Lesson 3(Answer all questions in this section) 49. 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?

Reorder the clauses in the query.

Remove the tables aliases in the WHERE clause.

Remove the table aliases in the ORDER BY clause.

Include a HAVING clause.

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

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

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 62: finalkit

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;

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 63: finalkit

Section 12 Lesson 1(Answer all questions in this section) 1. A foreign key can not refer

to a primary key in the same table. True or False?

True

False

2. Identify all of the incorrect statements that complete this sentence: A primary key is:

(Choose Three) (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

3. A table must have a primary key. True or False?

True

False

4. If a primary key is a set of columns then one column must be null. True or False?

True

False

Section 12 Lesson 2(Answer all questions in this section) 5. Why would this table name NOT work in an Oracle database? This_year_end+next_year

Table names must begin with an alphabetic character

Too long

The Plus sign + is not allowed in object names

None of the above

6. The transformation from an ER diagram to a physical design involves changing

terminology. Secondary Unique Identifiers becomes

Columns

Tables

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 64: finalkit

Unique Constraints

Primary Key Constraints

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

Section 12 Lesson 3(Answer all questions in this section) 8. It is possible to implement non-transferability via a simple Foreign Key Relationship. True or False?

Mark for Review (1) Points

True

False

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

Section 12 Lesson 4(Answer all questions in this section) 10. 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

Section 12 Lesson 4(Answer all questions in this section) 11. When translating an arc relationship to a physical design, you must turn the arc relationships into foreign keys. Assuming you are implementing an Exclusive 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

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 65: finalkit

False

Section 13 Lesson 1(Answer all questions in this section) 12. The

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

True

False

13. What command can used to create a new row in a table in the database? Mark for Review (1) Points

CREATE

NEW

ADD

INSERT

Section 16 Lesson 1(Answer all questions in this section) 14. When

listing columns in the SELECT list, what should you use to separate the columns? Mark for Review (1) Points

Commas

Semicolons

Dashes

Underscores

15. 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 *

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 66: finalkit

FROM albums;

SELECT alb_title, alb_artist, alb_dates FROM album;

SELECT * FROM album;

SELECT alb_title; alb_artist; alb_date FROM albums;

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

17. If a SQL statement returns data from two or more tables, which SQL capability is

being used? Mark for Review (1) Points

Selection

Projection

Joining

Insertion

18. In which clause of a SELECT statement would you specify the name of the table 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 SELECT statement.

19. Evaluate this SELECT statement:

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 67: finalkit

SELECT (salary * raise_percent) raise FROM employees;

If the RAISE_PERCENT column only contains null values, what will the statement return?

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

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

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 68: finalkit

Statement 1 will display a different column heading.

One of the statements will NOT execute.

Section 16 Lesson 3(Answer all questions in this section) 21. You cannot use

computers unless you completely understand exactly how they work. True or False?

Mark for Review (1) Points

True

False

22. There is only one kind of software used by all computers. True or Fale?

Mark for Review (1) Points

True

False

Section 17 Lesson 1(Answer all questions in this section) 23.

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.

24. When using the LIKE condition, which symbol represents any sequence of

none, one or more characters? Mark for Review (1) Points

_

%

#

&

25. Which of the following elements cannot be included in a WHERE

clause? Mark for Review (1) Points

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 69: finalkit

A column alias

A column name

A comparison condition

A constant

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

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

28. You need to combine the FIRST_NAME and LAST_NAME columns in the EMPLOYEES table and display the columns as a combined character string. Which

operator should you use? Mark for Review (1) Points

+

|

||

AND

Section 17 Lesson 2(Answer all questions in this section) 29. What will the result of the following SELECT statement be:

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 70: finalkit

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 for 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 the new salary.

Display the last name, salary and the results of adding 300 to the salary of the first employee row

30. The PLAYERS table contains these columns: PLAYER_ID NUMBER (9) Primary Key

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;

Section 17 Lesson 2(Answer all questions in this section) 31. You want to retrieve a list of customers whose last names begin with the letters Fr . Which keyword should you include in

the WHERE clause of your SELECT statement to achieve the desired result? Mark for Review (1) Points

AND

IN

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 71: finalkit

BETWEEN

LIKE

32. Evaluate this SELECT statement:

SELECT * FROM employees WHERE department_id IN(10, 20, 30) AND salary > 20000;

Which values would cause the logical condition to return TRUE?

Mark for Review (1) Points

DEPARTMENT_ID = 10 and SALARY = 20000

DEPARTMENT_ID = 20 and SALARY = 20000

DEPARTMENT_ID = null and SALARY = 20001

DEPARTMENT_ID = 10 and SALARY = 20001

33. You need write a SELECT statement that should only return rows that contain 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 values? Mark for Review (1) Points

=

!=

IN

BETWEEN..AND..

Section 17 Lesson 3(Answer all questions in this section) 34. You want to create a report that displays all employees who were hired before 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) HIRE_DATE DATE DEPARTMENT_ID NUMBER(4)

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 72: finalkit

The SALARY table contains these columns:

SALARY_ID 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;

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

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

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 73: finalkit

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);

Section 18 Lesson 1(Answer all questions in this section) 37. Which

comparison condition means "Less Than or Equal To?" Mark for Review (1) Points

"=)"

"+<"

">="

"<="

38. You need to replace null values in the DEPARTMENT_ID column with a zero (0).

Which function should you use? Mark for Review (1) Points

NVL

NULL

NULLIF

REPLACE

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 74: finalkit

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

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

Section 18 Lesson 1(Answer all questions in this section) 41. From left to right, what is

the correct order of Precedence? Mark for Review (1) Points

Arithmetic, Concatenation, Comparison, OR

NOT, AND, OR, Arithmetic

Arithmetic, NOT, Logical, Comparison

Arithmetic, NOT, Concatenation, Logical

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

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 75: finalkit

Section 18 Lesson 2(Answer all questions in this section) 43. 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.

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

100

45. Evaluate this SELECT statement:

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 76: finalkit

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?

Mark for Review (1) Points

SELECT employee_id, last_name, first_name, salary 'Yearly Salary'

FROM employees

WHERE salary IS NOT NULL

ORDER BY last_name, 3;

46. You need to create a report to display all employees that were hired on or before 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?

Mark for Review (1) Points

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';

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 77: finalkit

SELECT employee_id ||' - '|| last_name "Employee", hire_date ||' / '|| salary "Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-96';

47. Evaluate this SELECT statement:

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

Which operator is the same as the OR conditions used in this SELECT statement?

Mark for Review (1) Points

IN

AND

LIKE

BETWEEN ... AND ...

48. Evaluate this SELECT statement:

SELECT * FROM employees WHERE salary > 30000 AND department_id = 10 OR email IS NOT NULL;

Which statement is true?

Mark for Review (1) Points

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

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 78: finalkit

Section 18 Lesson 3(Answer all questions in this section) 49. 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;

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

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 79: finalkit

Mark for Review (1) Points

Reorder the clauses in the query.

Remove the tables aliases in the WHERE clause.

Remove the table aliases in the ORDER BY clause.

Include a HAVING clause.

This watermark does not appear in the registered version - http://www.clicktoconvert.com

Page 80: finalkit

Test: Quiz: Second Normal Form 1. What is the rule of Second Normal Form? All non-UID attributes must be dependent upon the entire UID (*) Some non-UID attributes can be dependent on the entire UID No non-UID attributes can be dependent on any part of the UID None of the Above 2. Examine the following entity and decide which attribute breaks the 2nd Normal Form rule: ENTITY: CLASS ATTRIBUTES: CLASS ID DURATION SUBJECT TEACHER NAME AND ADDRESS CLASS ID DURATION SUBJECT TEACHER NAME AND ADDRESS (*) 3. All instances of the subtypes must be an instance of the supertype. True (*) False 4. Not all instances of the supertype are instances of one of the subtypes. True False (*) 5. A supertype should have at least two subtypes. True (*)

Page 81: finalkit

False 6. An entity can be on 2nd Normal Form even if it has repeated values. True or False? True False (*) Test: Quiz: Third Normal Form 1. No databases in the world is ever truly on 3rd Normal Form. Everyone always stops after 2nd Normal Form. True or False? True False (*) 2. Examine the following Entity and decide which sets of attributes breaks the 3rd Normal Form rule: (Choose Two) ENTITY: TRAIN (SYNONYM: ROLLING STOCK) ATTRIBUTES: TRAIN ID MAKE MODEL DRIVER NAME DEPARTURE STATION NUMBER OF CARRIAGES NUMBER OF SEATS DATE OF MANUFACTURE (Choose all answers) TRAIN ID, MAKE DEPARTURE STATION, DRIVER NAME (*) NUMBER OF CARRIAGES, NUMBER OF SEATS (*) MODEL, DATE OF MANUFACTURE 3. As a database designer it is your job to store data in only one place and the best place. True or False?

Page 82: finalkit

True (*) False Section 7 Test: Quiz: Arcs 1. To visually represent exclusivity between two or more relationships in an ERD you would most likely use an ________. Arc (*) UID Subtype Supertype 2. Which of the following would best be represented by an arc? STUDENT (senior, junior) STUDENT (graduating, non-graduating) STUDENT (will-attend-university, will-not-attend-university) STUDENT ( University, Trade School) (*) 3. This diagram could also be expressed as a supertype/subtype construction. True or False? True False (*) 4. All parts of a UID are mandatory. True or False? True (*) False 5. Which of the following can be added to a relationship? an attribute

Page 83: finalkit

an arc can be assigned (*) a composite attribute an optional attribute can be created 6. Secondary UID's are not permitted in data modeling mandatory in data modeling useful as an alternative means identifying instances of an entity (*) always comprised of numbers 7. If the entity CD has the attributes: #number, *title, *producer, *year, o store name, o store address, this entity is in 3rd Normal Form ("no non-UID attribute can be dependent on another non-UID attribute). True or False? True False (*) 8. Which of the following is the definition for Third Normal Form? All attributes are single valued An attribute must be dependent upon entity's entire unique identifier No non-UID attribute can be dependent on another non-UID attribute (*) All attributes are uniquely doubled and independent Test: Quiz: Hierarchies and Recursive Relationships 1. A relationship can be both recursive and hierachal at the same time. True or False? True False (*) 2. A recursive rationship should not be part of a UID. True or False?

Page 84: finalkit

True (*) False 3. Which of the following would be a good Unique Identifier for its Entity? (Choose Two) (Choose all answers) Identification Number for Person (*) Birthdate for Baby Which Includes Hour, Minute, and Seconds (*) Order date for Order Vehicle Type Number for Car 4. In this simple diagram, what comprises the unique identifier for the student class entity? student id and class id student id, class id and course id course id student id and course id (*) Test: Quiz: Modeling Historical Data 1. Historical data should always be kept. True or False? True False (*) 2. Modeling historical data can produce a unique identifier that includes a date. True or False? True (*) False 3. Audit trail attributes cannot be placed in the entities they are auditing, they must be placed in separate, new entities, created just for that purpose. True or False?

Page 85: finalkit

True False (*) 4. Which of the following scenarios should be modeled so that historical data is kept? (Choose two) (Choose all answers) LIBRARY and BOOK (*) STUDENT and AGE STUDENT and GRADE (*) LIBRARY and NUMBER OF STAFF Section 8 Test: Quiz: What is a Consultant 1. How does the dictionary define "consultant"? A person who knows everything One responsible for knowing everything One who gives expert or professional advice (*) None of the Above 2. Which of the following skills are required for Consultants. (Choose Two) (Choose all answers) Communication skills (*) Excellent drawing skills Must be able to speak at least two languages fluently, preferably four or more Team-working skills (*)

Page 86: finalkit

3. Only Consultants can develop new data models for a company, they are mandatory, so companies must find them and hire them. True or False? True False (*) Test: Quiz: Overcoming the Fear Factor 1. Which of the following is a valid technique for effective public speaking? Making eye contact Using familiar words when communicating technical information Being enthusiastic All of the Above (*) 2. Your apperance at a presentation is not important, you should just show up and give the presentation in whatever clothes makes you comfortable. So feel free to wear Jeans and old T-Shirts etc. Being comfortable is more important than anything else. True or False? True False (*) 3. When you are involved in a group presentation, your group should practice before hand and agree on who presents the various parts. You should all be involved somehow. True or False? True (*) False Test: Quiz: Modeling Change: Time

Page 87: finalkit

1. How do you know when to use the different types of time in your design? The rules are fixed and should be followed It depends on the functional needs of the system (*) You would first determine the existence of the concept of time and map it against the Greenwich Mean Time Always model time, you can take it out later if it is not needed 2. It is desirable to have an entity called DAY with a holiday attribute when you want to track special holidays in a payroll system. True or False? True (*) False 3. When you add the concept of time to your data model, you are: Simplifying your model. Adding complexity to your model. (*) Just changing the model, but this does not change the complexity of it. None of the above. 4. What is the benefit to the users of a system that includes "time," e.g. Start Date and End Date for Employees? Increased usability and flexibility of a system; we can the trace e.g. the different managers an employee had over time. (*) System becomes 100% unstable; allows users to log on and log off at will. Users are able to create complex programs in support of this component. Reporting becomes nearly impossible, users enjoy this.

Page 88: finalkit

5. If you are tracking employment dates for an employee, do you need to have an "End Date" attribute? Yes, because you always need an end date when you have a start date No, because an end date is usually redundant Yes, if the company wants to track employee information, like multiple start and end dates (*) No, not if the company likes the employee 6. Which of the following would be a logical constraint when modeling time for a country entity? People have births and deaths in their countries that must be tracked by the system. If you are doing a system for France or Germany, you would need security clearance. Countries may need an end date in your system, because they can change fundamentally over time, e.g. Yugoslavia. (*) You need a constant record of countries, because they are still countries, even if leadership changes over time, e.g. France, USA and most other countries. 7. Modeling historical data produces efficient ways for a business to operate such as: Modeling historical data does not help a business. Providing valuable information via reports to management . (*) Keeping track of holiday dates. Employees can work in two time zones. Test: Quiz: Modeling Change: Price 1. Why would you want to model a time component when designing a system that lets people buy bars of gold? The price of gold fluctuates and for determining price, you need to know the time of purchase (*) To allow the sales people to determine where the gold is coming from

Page 89: finalkit

You would not want to model this, it is not important The Government of your country might want to be notified of this transaction. 2. What is the function of logging or journaling in conceptual data models? Allows you to track the history of attribute values, relationships and/or entire entities (*) Gives a timestamp to all entities Represents entities as time in the data model Creates a fixed time for all events in a data model 3. Which of the following is a logical constraint that could result from considering how time impacts an example of data storage? End Date must be before the Start Date. ASSIGNMENT periods can overlap causing the database to crash. An ASSIGNMENT may only refer to a COUNTRY that is valid at the Start Date of the ASSIGNMENT. (*) Dates can be valued only with Time. 4. You are doing a data model for a computer sales company, where the price goes down on a regular basis. If you want to allow them to modify the price and keep track of the changes, what is the best way to model this? A. Create a product entity and a related price entity with start and end dates, and then let the users enter the new price whenever required. B. Create a new item and a new price every day. C. Use a price entity with a start and end date D. Allow them to delete the item and enter a new one. E. Both A and C (*)

Page 90: finalkit

Test: Quiz: Drawing Conventions for Readability 1. There are no formal rules for how to draw ERD's. The most important thing is to make sure all entities, attributes and relationships are documented on diagram. The layout is not significant. True or False? True False (*) 2. It is a good idea to group your entities in a diagram according to the expected volumes. By grouping high volume entities together, the diagrams could become easier to read. True or False? True (*) False 3. Which of the following statements are true for ERD's to enhance their readability. (Choose Two) (Choose all answers) There should be no crossing lines. (*) All crows feet (Many-ends) of relationships should point the same way. (*) There should be many crossing lines. It does not matter which way the crows feet (many ends) point. 4. You must make sure all entities of a proposed system can fit onto one diagram. It is not allowed to break up a data model into more than one diagram. True or False? True False (*) Test: Quiz: Generic Modeling 1. Generic models are generally less complex than a specific model. True or False?

Page 91: finalkit

True False (*) 2. All data models MUST have some portions of the model modeled as a generic component. True or False? True False (*) 3. When you transform a specific model to be generic, which of the following statements are true? (Choose Two) (Choose all answers) You tend to end up with fewer entities in the generic model than you had in the specific model. (*) Either all or none of the original attributes make it into the generic model. (*) You will always have more entities in a generic model than in the corresponding specific model. None of the original specific model attributes are allowed in a generic model. Test: Quiz: Introduction to Relational Database Concepts 1. Identify all of the statements that complete this sentence: A primary key is: (Choose Three) (Choose all answers) A single column that uniquely identifies each row in a table. (*) A set of columns that uniquely identifies each row in a table. (*) A set of columns and keys in a single table that uniquely identifies each row in a single table. (*) Only one column that cannot be null. 2. A table does not have to have a primary key. True or False?

Page 92: finalkit

True (*) False 3. One or more columns in a primary key can be null. True or False? True False (*) 4. A foreign key always refers to a primary key in the same table. True or False? True False (*) 5. Foreign keys cannot be null when: It is part of a primary key. (*) It refers to another table. It contains three or more columns. 6. Column integrity refers to: Columns always having values. Columns always containing positive numbers. Columns always containing values consistent with the defined data format. (*) Columns always containing text data less than 255 characters.

Page 93: finalkit

7. The explanation below defines which constraint type: A primary key must be unique, and no part of the primary key can be null. Entity integrity. (*) Referential integrity. Column integrity. User-defined integrity. 8. The explanation below defines which constraint type: A column must contain only values consistent with the defined data format of the column. Entity integrity. Referential integrity. Column integrity. (*) User-defined integrity. 9. The explanation below is an example of what constraint type: The value in the dept_no column of the EMPLOYEES table must match a value in the dept_no column in the DEPARTMENTS table. Entity integrity. Referential integrity. (*) Column integrity. User-defined integrity. 10. The explanation below is an example of what constraint type:

Page 94: finalkit

If the value in the balance column of the ACCOUNTS table is below 100, we must send a letter to the account owner which will require extra programming to enforce. Entity integrity. Referential integrity. Column integrity. User-defined integrity. (*) Test: Quiz: Basic Mapping: The Transformation Process 1. In a physical data model, an entity becomes a _____________. Attribute Table (*) Constraint Column 2. In a physical data model, a relationship is represented as a: Column Primary Key Unique Identifier Foreign Key (*) 3. Attributes become columns in a database table. True or False? True (*) False 4. Why would this table name NOT work in an Oracle database? 2007_EMPLOYEES

Page 95: finalkit

Numbers cannot be incorporated into table names Table names must start with an alphabetic character (*) Underscores "_" are not allowed in table names None of the above 5. In an Oracle database, why would the following table name not be allowed 'EMPLOYEE JOBS'? The database does not understand all capital letters EMPLOYEE is a reserved word JOBS is a reserved word You cannot have spaces between words in a table name (*) 6. The transformation from an ER diagram to a physical design involves changing terminology. Entities in the ER diagram become __________ , and attributes become ____________. Columns, Tables Tables, Columns (*) Foreign Keys, Columns Tables, Foreign Keys 7. The transformation from an ER diagram to a physical design involves changing terminology. Relationships in the ER diagram become __________ , and primary unique identifiers become ____________. Foreign keys, primary keys (*) Primary keys, foreign keys Foreign keys, mandatory business rules

Page 96: finalkit

Foreign keys, optional business rules Test: Quiz: Relationship Mapping 1. What do you create when you transform a many to many relationship from your ER diagram into a physical design? Foreign key constraints Intersection entity Intersection table (*) Primary key constraints 2. Relationships on an ERD can only be transformed into UIDs in the physical model? True or False? True False (*) 3. One-to-One relationships are transformed into Foreign Keys in the tables created at either end of that relationship? True or False? True False (*)

Page 97: finalkit

4. One-to-Many Optional to Mandatory becomes a _______________ on the Master table. Mandatory Foreign Key Nothing (There are no new columns created on the Master table) (*) Optional Foreign Key Primary Key 5. Two entities A and B have an optional (A) to Mandatory (B) One-to-One relationship. When they are transformed, the Foreign Key(s) is placed on: The table BS (*) The Table AS Nowhere, One-to-One are not transformed Both tables As and Bs get a new column and a Foreign Key. 6. A barrred Relationship will result in a Foreign Key column that also is part of: The Table Name The Column Name The Check Constraint The Primary Key (*) Test: Quiz: Subtype Mapping

Page 98: finalkit

1. The "Arc Implementation" is a synonym for what type of implementation? Supertype Implementation Subtype Implementation Cascade Implementation Supertype and Subtype Implementation (*) 2. When translating an arc relationship to a physical design, you must turn the arc relationships into foreign keys. What additional step must you take with the created foreign keys to ensure the exclusivity principle of arc relationships? (Assume that you are implementing an Exclusive Design) (Choose Two) (Choose all answers) Make all relationships mandatory Make all relationships optional (*) Create an additional check constraint to verify that one foreign key is populated and the others are not (*) All the above 3. 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 optional. True or False? True (*) False 4. Which of the following are reasons you should consider when using a Subtype Implementation? (Choose Two) (Choose all answers) When the common access paths for the subtypes are similar.

Page 99: finalkit

When the common access paths for the subtypes are different. (*) Business functionality and business rules are similar between subtypes. Most of the relationships are at the subtype level (*) Test: Quiz: SQL Introduction: Querying the Database 1. What command retrieves data from the database? ALTER SELECT (*) DESCRIBE INSERT 2. What command can be used to show information about the structure of a table? ALTER SELECT DESCRIBE (*) INSERT

Page 100: finalkit

3. What command can be added to a select statement to return a subset of the data? WHERE (*) WHEN ALL EVERYONE 4. What command do you use to add rows to a table INSERT (*) ADD ADD_ROW NEW_ROW 5. Examine the follolowing SELECT statement. SELECT * FROM employees; This statement will retrieve all the rows in the employees table. True or False? True (*) False Test: Quiz: Basic Table Modifications

Page 101: finalkit

1. The SQL statement ALTER TABLE EMPLOYEES DROP COLUMN SALARY will delete all of the rows in the employees table. True or False? True False (*) 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 STATE='FL'; how many rows will be left in the table? 0 1 (*) 2 3 3. What will the following statement do to the employee table? ALTER TABLE employees ADD (gender VARCHAR2(1)) Add a new row to the EMPLOYEES table Rename a column in the EMPLOYEES table Change the datatype of the GENDER column Add a new column called GENDER to the EMPLOYEES table (*)

Page 102: finalkit

Test: Quiz: System Development Life Cycle 1. During which phases of the System Development Life Cycle would you roll out the system to the users? Build and Transition Strategy and Analysis Design and Production Transition and Production (*) 2. In which phases of the System Development Life Cycle will we need to use SQL as a language? (Choose Two) (Choose all answers) Analysis Transition (*) Strategy Build and Document (*) 3. The data model can be used to... Communicate and group Describe and specify

Page 103: finalkit

Analyze and copy All of the Above (*) Test: Quiz: Anatomy of a SQL Statement 1. The SQL SELECT statement is capable of: Selection and protection Selection and projection (*) Projection and updating None of the above 2. SELECT * FROM departments; is a: Keyword Statement (*) Declaration Strategy 3. The order of operator precedence is / + - * * - + / * / + - (*)

Page 104: finalkit

None of the above 4. If you want to see all columns of data in a table, you use what symbol? & % $ * (*) 5. If you want to see just a subset of the columns in a table, you use what symbol? & % * None of the above, instead of using a symbol you name the columns you want to see the data for. (*) 6. What is a NULL value? A perfect zero A known value less than zero A blank space An unknown value (*)

Page 105: finalkit

Test: Quiz: Relational Database Technology 1. RDBMS stands for Relational database manipulation system. Relational database management system. (*) Relational database mutilation system. Relational database management style. 2. The following statements are true regarding tables in a RDBMS: (Choose Two) (Choose all answers) A table is a logical object only. They cannot be created in a RDBMS. A table holds all the data necessary about something in the real world, such as employees, invoices or customers. (*) Tables contain fields, which can be found at the intersection of a row and a column. (*) It is not possible to relate multiple tables within an RDBMS. 3. The following table creation statement is valid. True or False? CREATE TABLE country ( ID NUMBER(6) NOT NULL, NAME VARCHAR2(30) NOT NULL, LOC VARCHAR2(40), REG_ID NUMBER, NAME VARCHAR2(25))

Page 106: finalkit

True False (*) 4. Once data has been created in a RDBMS, the ony way of getting it out again is by writing a Java or C program. No other languages can be used to access that data. True or False? True False (*) Test: Quiz: Working with Columns, Characters, and Rows 1. The structure of the table can be displayed with the _________ command: Desc Describe Dis A and B (*) 2. The concatenation operator ... Brings together columns or character strings into other columns Creates a resultant column that is a character expression Is represented by two vertical bars ( || )

Page 107: finalkit

All of the above (*) 3. In order to eliminate duplicate rows use the ________ keyword FIRST_ONLY DISTINCT (*) SINGLES_ONLY EXCLUSIVE 4. Which of the following is NOT BEING DONE in this SQL statement? SELECT first_name || ' ' || last_name "Name" FROM employees; Concatenating first name, middle name and last name (*) Putting a space between first name and last name Selecting columns from the employees table Using a column alias 5. The following is a valid SQL SELECT statement. True or False? SELECT first_name || ' ' || last_name alias AS Employee_Name FROM employees: True False (*)

Page 108: finalkit

Test: Quiz: Limit Rows Selected 1. To restrict the rows returned from an SQL Query, you should use the _____ clause: SELECT WHERE (*) GROUP BY CONDITION All of the above 2. Which example would limit the number of rows returned? SELECT title FROM d_songs WHEN type_code = 88; SELECT title FROM d_songs WHERE type_code = = 88; SELECT title FROM d_songs WHERE type_code = 88; (*) SELECT title FROM d_songs WHEN type_code = = 88; 3. Which query would give the following result? LAST_NAME FIRST_NAME DEPARTMENT_ID King Steven 90 SELECT last_name, first_name, department_id FROM employees C WHERE last_name = 'KING';

Page 109: finalkit

SELECT last_name, first_name, department_id FROM employees WHERE last_name = 'King'; (*) SELECT last_name, first_name, department_id FROM employees WHERE last_name LIKE 'k%'; SELECT last_name, first_name, department_id FROM employees WHERE last_name LIKE 'KING'; 4. Which of the following statements will work? SELECT first_name ||' '||last_name NAME, department_id DEPARTMENT, salary*12 "ANNUAL SALARY" FROM employees WHERE name = 'King'; SELECT first_name ||' '||last_name NAME, department_id DEPARTMENT, salary*12 "ANNUAL SALARY" FROM employees WHERE last_name = 'King'; (*) SELECT first_name ||' '||last_name NAME, department_id DEPARTMENT, salary*12 'ANNUAL SALARY' FROM employees WHERE last_name = 'King'; SELECT first_name ||' '||last_name NAME, department_id DEPARTMENT, salary*12 'ANNUAL SALARY' FROM employees WHERE name = 'King'; 5. Which of the following would be returned by this SELECT statement: SELECT last_name, salary FROM employees WHERE salary < 3500;

Page 110: finalkit

LAST_NAME SALARY King 5000 LAST_NAME SALARY Rajas 3500 LAST_NAME SALARY Davies 3100 (*) All of the above 6. Which of the following are true? (Choose Two) (Choose all answers) Character strings are enclosed in double quotation marks Date values are enclosed in single quotation marks (*) Character values are not case-sensitive Date values are format-sensitive (*) 7. How can you write not equal to in the WHERE-clause != ^= <> All of the above (*)

Page 111: finalkit

EXCLUSIVE 4. Which of the following is NOT BEING DONE in this SQL statement? SELECT first_name || ' ' || last_name "Name" FROM employees; Concatenating first name, middle name and last name (*) Putting a space between first name and last name Selecting columns from the employees table Using a column alias 5. The following is a valid SQL SELECT statement. True or False? SELECT first_name || ' ' || last_name alias AS Employee_Name FROM employees: True False (*) Test: Quiz: Comparison Operators 1. Which of the following are examples of comparison operators used in the WHERE clause?

Page 112: finalkit

=, >, <, <=, >=, <> between ___ and ___ in (..,..,.. ) like is null All of the above (*) 2. When using the "LIKE" operator, the % and _ symbols can be used to do a pattern-matching, wild card search. True or False? True (*) False 3. Which statement would select salaries that are greater than or equal to 2500 and less than or equal to 3500? Choose two answers. (Choose all answers) WHERE salary >= 2500 AND salary <= 3500 (*) WHERE salary <=2500 AND salary >= 3500 WHERE salary BETWEEN 2500 AND 3500 (*) WHERE salary BETWEEN 3500 AND 2500 4. Which of the following WHERE clauses would not select the number 10? WHERE hours BETWEEN 10 AND 20 WHERE hours <= 10 WHERE hours <>10 (*) WHERE hours IN (8,9,10)

Page 113: finalkit

Test: Quiz: Logical Comparisons and Precedence Rules 1. Which of the following statements best describes the rules of precedence when using SQL? The order in which the columns are displayed The order in which the expressions are sorted The order in which the operators are returned The order in which the expressions are evaluated and calculated (*) All of the above 2. Which of the following is earliest in the rules of precedence? Concatenation operator Logical condition Comparison condition Arithmetic operator (*) 3. Which symbol in the WHERE clause means "Not Equal To"? (Choose Two) (Choose all answers) NOT IN (...) (*) =+ <> (*)

Page 114: finalkit

>< 4. Which of the following are examples of logical operators that might be used in a WHERE clause. (Choose Two) (Choose all answers) AND, OR (*) < >, =, <=, >=, <> NOT (*) LIKES All of the above 5. What will be the results of the following selection? SELECT * FROM employees WHERE last_name NOT LIKE 'A%' AND last_name NOT LIKE 'B%' All last names that begin with A or B All last names that do not begin with A or B (*) No rows will be returned. There is a syntax error All rows will be returned 6. Find the clause that will give the same results as: SELECT * FROM d_cds WHERE cd_number NOT IN(90, 91, 92); WHERE cd_id <=90 and cd_id >=92; WHERE cd_id NOT LIKE (90, 91, 92);

Page 115: finalkit

WHERE cd_id != 90 and cd_id != 91 and cd_id != 92; (*) WHERE cd_id != 90 or cd_id != 91 or cd_id!= 92; 7. Which of the following would be returned by this SQL statement: SELECT First_name, last_name, department_id FROM employees WHERE department_id IN(50,80) AND first_name LIKE 'C%' OR last_name LIKE '%s%' FIRST_NAME LAST_NAME DEPARTMENT_ID Shelly Higgins 110 FIRST_NAME LAST_NAME DEPARTMENT_ID Curtis Davies 50 FIRST_NAME LAST_NAME DEPARTMENT_ID Randall Matos 50 FIRST_NAME LAST_NAME DEPARTMENT_ID Michael Hartstein 20 All of the above (*) In . Refer to 8 Test: Quiz: Sorting Rows

Page 116: finalkit

1. Which of the following is true of the ORDER BY clause: (Choose Two) (Choose all answers) Must be the last clause of the SQL statement (*) Displays the fetched rows in no particular order Defaults to a descending order (DESC) Defaults to an ascending order (ASC) (*) 2. What columns can be added to the following SELECT statement in its ORDER BY clause? (Choose Three) SELECT first_name, last_name, salary, hire_date FROM employees WHERE department_id = 50 ORDER BY ?????; (Choose all answers) last_name, first_name. (*) All columns in the EMPLOYEES table. (*) The table name, EMPLOYEES, which would then automatically sort by all columns in the table. Any column in the EMPLOYEES table, any expression in the SELECT list or any ALIAS in the SELECT list. (*) All the columns in the database. 3. A column alias can be specified in an ORDER BY Clause. True or False? True (*) False

Page 117: finalkit

4. What clause must you place in a SQL statement to have your results sorted from highest to lowest salary? ORDER BY salary ASC ORDER BY salary DESC (*) ORDER salary BY DESC None, the database always sorts from highest to lowest on the salary column. Test: Quiz: Introduction to Functions 1. The conversion function TO_CHAR is a single row function. True or False? True (*) False 2. The function COUNT is a single row function. True or False? True False (*) 3. The following statement represents a multi-row function. True or False? SELECT UPPER(last_name)

Page 118: finalkit

FROM employees; True False (*) 4. The following statement represents a multi-row function. True or False? SELECT MAX(salary) FROM employees True (*) False 5. Will the following statement return one row? SELECT MAX(salary), MIN(Salary), AVG(SALARY) FROM employees; No, it is illegal. You cannot use more than one multi-row function in a SELECT statement Yes, it will return the highest salary, the lowest salary and the average salary from all employees (*) Yes, it will return the highest salary from each employee Yes, it will return the average salary from the employees table. Oracle Academy Database Programming with SQL - Teacher Character, Number and Date Functions 1. What does the following SQL SELECT statement return? SELECT UPPER( SUBSTR('Database Programming', INSTR('Database Programming','P'),20)) FROM dual;

Page 119: finalkit

Programming PROGRAMMING (*) Database DATABASE 2. Single row functions may be used in ______, _______ and _______ clauses. (Choose two answers.) (Choose all answers) SELECT, FROM, ALWAYS FROM, SELECT, ORDERS WHERE, DECODE, ORDER BY (*) SELECT, WHERE, ORDER BY (*) 3. Which query selects the first names of the DJ On Demand clients who have a first name beginning with "A"? SELECT UPPER(first_name) FROM d_clients WHERE first_name LIKE %a% SELECT UPPER(first_name) FROM d_clients v WHERE first_name LIKE '%a%' SELECT UPPER(first_name) FROM d_clients WHERE first_name LIKE 'a%' SELECT UPPER(first_name) FROM d_clients WHERE LOWER(first_name) LIKE 'a%' (*) 4. Which character manipulation function always returns a numerical value? TRIM LPAD

Page 120: finalkit

LENGTH (*) SUBSTR 5. Which query would return a user password combining the ID of an employee and the first 4 digits of the last name? SELECT CONCAT (employee_id, SUBSTR(last_name,4,1)) AS "User Passwords" FROM employees SELECT CONCAT (employee_id, INSTR(last_name,4,1)) AS "User Passwords" FROM employees SELECT CONCAT (employee_id, INSTR(last_name,1,4)) AS "User Passwords" FROM employees SELECT CONCAT (employee_id, SUBSTR(last_name,1,4)) AS "User Passwords" FROM employees (*) 6. Character functions accept character arguments and only return character values. True or False? True False (*) 7. Which of the following are types of SQL functions? (Choose two answers.) (Choose all answers) Multi-Row Functions (*) Column-Row Functions Single-Row Functions (*) Many-to-Many Functions 8. Which of the following SQL statements would ly return a song title identified in the database as "All These Years"? WHERE title CONTAINS 'Years'; WHERE title LIKE LOWER('all these years');

Page 121: finalkit

WHERE title IN('All','These','Years'); WHERE title LIKE INITCAP('%all these years'); (*) 9. Identify the output from the following SQL statement: SELECT RPAD('SQL',6, '*') FROM DUAL; ******SQL ***SQL SQL*** (*) SQL****** Test: Quiz: Number Functions 1. The answer to the following script is 456. True or False? SELECT TRUNC(ROUND(456.98)) FROM dual True False (*) 2. ROUND and TRUNC functions can be used with which of the following Datatypes? Dates and numbers (*) Dates and characters Numbers and characters None of the above 3. Which number function may be used to determine if a value is odd or even? MOD (*) TRUNC

Page 122: finalkit

ROUND BINARY 4. What is the result of the following SQL Statement: SELECT ROUND(45.923,-1) FROM DUAL; 46 45.9 50 (*) None of the above Test: Quiz: Date Functions Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. Which query would return a whole number if the sysdate is 26-MAY-04? Mark for Review SELECT TRUNC(MONTHS_BETWEEN(SYSDATE,'19-MAR-79') /12) AS YEARS FROM DUAL; (*) SELECT TRUNC(YEARS_BETWEEN(SYSDATE,'19-MAR-79') /12) AS YEARS FROM DUAL; SELECT MONTHS_BETWEEN(SYSDATE,'19-MAR-79') /12 AS YEARS FROM DUAL; None of the above 2. Round and Trunc can be used on Date datatypes. True or False? Mark for Review True (*)

Page 123: finalkit

False 3. What is the result of the following query? SELECT ADD_MONTHS ('11-JAN-94',6) FROM dual; Mark for Review 1/17/2004 1/11/1995 7/11/1994 (*) 7/17/1994 4. What is the result of the following query? SELECT ADD_YEARS ('11-JAN-94',6) FROM dual; Mark for Review This in not a valid SQL statement. (*) 7/11/1995 1/11/2000 7/11/2000 5. What function would you use to return the highest date in a month? Mark for Review FINAL_DAY END_DAY HIGHEST_DAY LAST_DAY (*) 6. If hire_date has a value of '03-July-03', then what is the output from this code? SELECT ROUND(hire_date, 'Year') FROM employees; Mark for Review 01-JAN-04 (*) 01-JAN-03 01-JUL-03 01-AUG-03

Page 124: finalkit

Section 2 Single Row Functions Test: Quiz: Conversion Functions Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. The following script will run successfully. True or False? SELECT TO_CHAR(TO_DATE("25-DEC-04",'dd-MON-yy')) FROM dual Mark for Review True False (*) 2. You need to display the HIRE_DATE values in this format: 25th of July 2002. Which SELECT statement would you use? Mark for Review SELECT enroll_date(hire_date, 'DDspth "of" Month YYYY') FROM employees; SELECT TO_CHAR(hire_date, 'ddth "of" Month YYYY') FROM employees; (*) SELECT TO_CHAR(hire_date, 'DDTH "of" Month YYYY') FROM employees; SELECT TO_CHAR(hire_date, 'DDspth 'of' Month RRRR') FROM employees; 3. Sysdate is 12-MAY-2004. You need to store the following date: 7-DEC-89 Which statement about the date format for this value is true? Mark for Review Both the YY and RR date formats will interpret the year as 1989.

Page 125: finalkit

Both the YY and RR date formats will interpret the year as 2089. The RR date format will interpret the year as 1989, and the YY date format will interpret the year as 2089. (*) The RR date format will interpret the year as 2089, and the YY date format will interpret the year as 1989. 4. Which statement is true about SQL functions? Mark for Review Functions can convert values or text to another data type. Functions can round a number to a specified decimal place. Functions can convert upper case characters to lower case characters. a, b and c are true. (*) None of the above statements are true. 5. A table has the following definition: EMPLOYEES( EMPLOYEE_ID NUMBER(6) NOT NULL, LAST_NAME VARCHAR2(10) NOT NULL, MANAGER_ID VARCHAR2(6)) and contains the following rows: (1001, 'Bob Bevan', '200') (200,'Natacha Hansen', null) Will the following query work? SELECT * FROM employees WHERE employee_id = manager_id; Mark for Review No, because the WHERE-clause will not find any matching data. No, because the datatypes of ID and MANAGER are different. Yes, Oracle will perform implicit datatype conversion. (*) No. You will have to re-write the statement and perform explicit datatype conversion. 6. Which statement will return the salary of e.g. 6000 from the Employees table in the following format $6000.00? Mark for Review SELECT TO_CHAR(salary, '$99999.00') SALARY FROM employees (*)

Page 126: finalkit

SELECT TO_CHAR(salary, '99999.00') SALARY FROM employees SELECT TO_CHAR(salary, '$99999') SALARY FROM employees SELECT TO_CHAR(sal, '$99999.00') SALARY FROM employees Test: Quiz: Null Functions Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. The following statement returns 0 (zero). True or False? SELECT 121/NULL FROM dual; Mark for Review True False (*) 2. If quantity is a number datatype, what is the result of this statement? SELECT NVL(200/quantity, 'zero') FROM inventory; Mark for Review zero ZERO The statement fails (*) Null 3. Which function compares two expressions? Mark for Review NVL NULLIF (*) NVL2 NULL 4. Consider the following data in the Employees table:

Page 127: finalkit

(last_name, commission_pct, manager_id) DATA: King,null,null Kochhar, null,100 Vargas, null, 124 Zlotkey,.2, 100 What is the result of the following statement: SELECT last_name, COALESCE(commission_pct, manager_id, -1) comm FROM employees ; Mark for Review Statement will fail King, -1 Kochhar, 100 Vargas, 124 Zlotkey, .2 (*) King, -1 Kochhar, 100 Vargas, 124 Zlotkey, 100 King, null Kochhar, 100 Vargas, 124 Zlotkey, .2 5. With the following data in Employees (last_name, commission_pct, manager_id) what is the result of the following statement? DATA: King,null,null Kochhar, null,100 Vargas, null, 124 Zlotkey,.2, 100 SELECT last_name, NVL2(commission_pct, manager_id, -1) comm FROM employees ; Mark for Review King, -1 Kochhar, -1 Vargas, -1 Zlotkey, .2 Statement will fail.

Page 128: finalkit

King, -1 Kochhar, 100 Vargas, 124 Zlotkey, .2 King, -1 Kochhar, -1 Vargas, -1 Zlotkey, 100 (*) Test: Quiz: Conditional Expressions Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. CASE and DECODE evaluate expressions in a similar way to IF-THEN-ELSE logic. However, DECODE is specific to Oracle syntax. True or False? Mark for Review True (*) False 2. Which of the following is a conditional expression used in SQL? Mark for Review CASE (*) DESCRIBE WHERE NULLIF 3. Which statement will return a listing of last names, salaries and a rating of 'Low', 'Medium', 'Good' or 'Excellent' depending on the salary value? Mark for Review SELECT last_name,salary, (CASE WHEN salary < 5000 THEN 'Low' WHEN salary < 10000 THEN 'Medium' WHEN salary < 20000 THEN 'Good' ELSE 'Excellent' END) qualified_salary FROM employees; (*)

Page 129: finalkit

SELECT last_name,salary, (CASE WHEN sal < 5000 THEN 'Low' WHEN sal < 10000 THEN 'Medium' WHEN sal < 20000 THEN 'Good' ELSE 'Excellent' END) qualified_salary FROM employees; SELECT last_name,sal, (CASE WHEN sal < 5000 THEN 'Low' WHEN sal < 10000 THEN 'Medium' WHEN sal < 20000 THEN 'Good' ELSE 'Excellent' END) qualified_salary FROM employees; SELECT last_name,salary, (RATING WHEN salary < 5000 THEN 'Low' WHEN salary < 10000 THEN 'Medium' WHEN salary < 20000 THEN 'Good' ELSE 'Excellent' END) qualified_salary FROM employees; 4. For the given data from Employees (last_name, manager_id) what is the result of the following statement: DATA: ( King, null Kochhar, 100 De Haan, 100 Hunold, 102 Ernst, 103) SELECT last_name, DECODE(manager_id, 100, 'King', 'A N Other') "Works For?" FROM employees Mark for Review King, Null Kochhar, King De Haan, King Hunold, A N Other Ernst, A N Other King, A N Other Kochhar, King De Haan, King Hunold, A N Other Ernst, A N Other (*) Invalid statement.

Page 130: finalkit

King, A N Other Kochhar, King De Haan, King Hunold, Kochhar Ernst, De Haan Test: Quiz: Cartesian Product and the Join Operations Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. What is the result of a query that selects from two tables but includes no join condition? Mark for Review A Cartesian product. (*) A selection of matched rows from both tables. A Syntax error. A selection of rows from the first table only. 2. When must column names be prefixed by table names in JOIN syntax? Mark for Review When more than two tables participate in the join. Only when query speed and database performance is a concern. When the same column name appears in more than one table of the query. (*) Never. 3. If table A have 10 rows and table B have 5 rows, how many rows will be returned if you perform a cartesian join on those two tables? Mark for Review 5 50 (*) 10 15

Page 131: finalkit

4. If table A have 10 rows and table B have 5 rows, how many rows will be returned if you perform a equi-join on those two tables? Mark for Review 50 10 5 It depends on the data found in the two tables. (*) 5. Will the following statement work? SELECT department_name, last_name FROM employees, departments WHERE department_id = department_id; Mark for Review Yes, there are no syntax errors in the statement. No, Oracle will return a column ambiguously defined error. (*) Yes, Oracle will resolve which department_id colum comes from which table. No, Oracle will not allow joins in the WHERE clause. 6. Oracle proprietary JOINS can use the WHERE clause for conditions other than the join-condition. True or False? Mark for Review True (*) False Test: Quiz: Nonequijoins Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. Which of the following operators is/are typically used in a nonequijoin? Mark for Review NOT OR IN >=, <=, BETWEEN ...AND (*)

Page 132: finalkit

* 2. Which statement about joining tables with a non-equijoin is false? Mark for Review A WHERE clause must specify a column in one table that is compared to a column in the second table (*) The number of join conditions required is always one less than the number of tables being joined The columns being joined must have compatible data types None of the above 3. The following statement is an example of a nonequi-join? SELECT e.last_name, e.salary, j.grade_level FROM employees e, job_grades j WHERE e.salary BETWEEN j.lowest_sal AND j.highest_sal; True or False? Mark for Review True (*) False Test: Quiz: Outer Joins Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. Which symbol is used to perform an outer join? Mark for Review * || (+) (*) # 2. The ID column in the CLIENT table that corresponds to the CLIENT_ID column of the ORDER table contains null values for rows that need to be displayed. Which type of join should you use to display the data? Mark for Review Equijoin

Page 133: finalkit

Self join Outer join (*) Nonequi-Join 3. To perform a valid outer join between DEPARMENTS and EMPLOYEES to list departments without employees select the correct WHERE clause for the following select statement: SELECT d.department_name, e.last_name FROM employees e, departments d WHERE Mark for Review e.department_id(+) = d.department_id (*) e.department_id(+) = d.department_id(+) e.department_id = d.department_id(+) e.department_id = d.department_id 4. The following is a valid outer join statement: SELECT c.country_name, d.department_name FROM countries c, departments d WHERE c.country_id (+) = d.country_id (+) True or False? Mark for Review True False (*) Test: Quiz: Self Joins and Hierarchical Queries Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. Which of the following database design concepts is implemented with a self join? Mark for Review Non-Transferability Recursive Relationship (*) Supertype Arc 2. Which SELECT statement implements a self join? Mark for Review

Page 134: finalkit

SELECT e.employee_id, m.manager_id FROM employees e NATURAL JOIN employees m; SELECT e.employee_id, m.manager_id FROM employees e, employees m WHERE m.employee_id = e.manager_id; (*) SELECT e.employee_id, m.manager_id FROM employees e, manager m WHERE e.employee_id = m.manager_id; SELECT e.employee_id, m.manager_id FROM employees e, departments m WHERE e.employee_id = m.manager_id; 3. Which select statement will return the last name and hire data of an employee and his/ her manager for employees that started in the company before their managers? Mark for Review SELECT w.last_name, w.hire_date, m.last_name, m.hire_date FROM employees w , employees m WHERE w.manager_id = m.employee_id AND w.hire_date < m.hire_date (*) SELECT w.last_name, w.hire_date, m.last_name, m.hire_date FROM employees w , employees m WHERE w.manager_id != m.employee_id AND w.hire_date < m.hire_date SELECT w.last_name, w.hire_date, m.last_name, m.hire_date FROM employees w , employees w WHERE w.manager_id = w.employee_id AND w.hire_date < w.hire_date SELECT w.last_name, w.hire_date, m.last_name, m.hire_date FROM employees w , employees m WHERE w.manager_id = m.employee_id AND w.hire_date > m.hire_date 4. Which of the following database design concepts do you need in your tables to write Hierarchical queries? Mark for Review Non-Transferability Recursive Relationship (*) Supertype

Page 135: finalkit

Arc 5. Hierarchical queries MUST use the LEVEL pseudo column. True or False? Mark for Review True False (*) 6. Hierarchical queries can walk both Top-Down and Bottom-Up. True or False? Mark for Review True (*) False Test: Quiz: Cross joins and Natural Joins Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. A NATURAL JOIN is based on: Mark for Review Columns with the same name and datatype (*) Columns with the same name Columns with the same datatype and width Tables with the same structure 2. The ___________ join is the ANSI-standard syntax used to generate a Cartesian product. Mark for Review NATURAL ALL FULL CROSS (*) 3. What happens when you create a Cartesian product? Mark for Review All rows from one table are joined to all rows of another table (*) No rows are returned as you entered wrong join-criteria

Page 136: finalkit

The table is joined to itself, one column to the next column, exhausting all possibilities All rows that do not match in the WHERE clause are displayed 4. The join column must be included in the select statement when you use the NATURAL JOIN clause. True or False? Mark for Review True False (*) Test: Quiz: Join Clauses Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. The keywords JOIN _____________ should be used to join tables with the same column names but different datatypes. Mark for Review NATURAL ON ON WHEN USING (*) 2. Table aliases MUST be used with columns referenced in the JOIN USING clause. True or False? Mark for Review True False (*) 3. The primary advantage of using JOIN ON is: Mark for Review The join happens automatically based on matching column names and data types It will display rows that do not meet the join condition It easily produces a Cartesian product between the tables in the statement It permits columns that don?t have matching data types to be joined

Page 137: finalkit

It permits columns with different names to be joined (*) 4. You can do nonequi-joins with ANSI-Syntax. True or False? Mark for Review True (*) False 5. The following is a valid SQL statement. SELECT e.employee_id, e.last_name, d.location_id, department_id FROM employees e JOIN departments d USING (department_id) ; True or False? Mark for Review True (*) False Test: Quiz: Inner versus Outer Joins Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. Which syntax would be used to retrieve all rows in both the EMPLOYEES and DEPARTMENTS tables, even when there is no match? Mark for Review FULL OUTER JOIN (*) LEFT OUTER JOIN AND RIGHT OUTER JOIN FULL INNER JOIN Use any equijoin syntax 2. What is another name for a simple join or an inner join? Mark for Review Nonequijoin Equijoin (*) Self Join Outer Join 3. The following statement is an example of what kind of join?

Page 138: finalkit

SELECT car.vehicle_id, driver.name FROM car LEFT OUTER JOIN driver ON (driver_id) ; Mark for Review Inner Join Outer Join (*) Equijoin Optimal Join 4. EMPLOYEES Table: Name Null? Type EMPLOYEE_ID NOT NULL NUMBER(6) FIRST_NAME VARCHAR2(20) LAST_NAME NOT NULL VARCHAR2(25) DEPARTMENT_ID NUMBER (4) DEPARTMENTS Table: Name Null? Type DEPARTMENT_ID NOT NULL NUMBER 4 DEPARTMENT_NAME NOT NULL VARCHAR2(30) MANAGER_ID NUMBER (6) A query is needed to display each department and its manager name from the above tables. However, not all departments have a manager but we want departments returned in all cases. Which of the following SQL: 1999 syntax scripts will accomplish the task? Mark for Review SELECT d.department_id, e.first_name, e.last_name FROM employees e LEFT OUTER JOIN departments d WHERE (e.department_id = d.department_id); SELECT d.department_id, e.first_name, e.last_name FROM employees e RIGHT OUTER JOIN departments d ON (e.employee_id = d.manager_id); (*) SELECT d.department_id, e.first_name, e.last_name FROM employees e FULL OUTER JOIN departments d ON (e.employee_id = d.manager_id); SELECT d.department_id, e.first_name, e.last_name FROM employees e, departments d WHERE e.employee_id RIGHT OUTER JOIN d.manager_id;

Page 139: finalkit

5. For which of the following tables will all the values be retrieved even if there is no match in the other? SELECT e.last_name, e.department_id, d.department_name FROM employees e LEFT OUTER JOIN departments d ON (e.department_id = d.department_id); Mark for Review employees (*) department both Neither. the LEFT OUTER JOIN limits the value to the matching department id's. 6. If you select rows from two tables (employees and departments) using an outer join, what will you get? Use the code below to arrive at your answer: SELECT e.last_name, e.department_id, d.department_name FROM employees e LEFT OUTER JOIN departments d ON (e.department_id = d.department_id); Mark for Review All employees that do not have a department_id assigned to them All employees including those that do not have a department_id assigned to them (*) No employees as the statement will fail None of the above 7. Given the following descriptions of the employees and jobs tables, which of the following scripts will display each employee?s possible minimum and maximum salaries based on their job title? EMPLOYEES Table: Name Null? Type EMPLOYEE_ID NOT NULL NUMBER (6) FIRST_NAME VARCHAR2 (20) LAST_NAME NOT NULL VARCHAR2 (25) EMAIL NOT NULL VARCHAR2 (25) PHONE_NUMBER VARCHAR2 (20) HIRE_DATE NOT NULL DATE JOB_ID NOT NULL VARCHAR2 (10) SALARY NUMBER (8,2) COMMISSION_PCT NUMBER (2,2) MANAGER_ID NUMBER (6) DEPARTMENT_ID NUMBER (4)

Page 140: finalkit

JOBS Table: Name Null? Type JOB_ID NOT NULL VARCHAR2 (10) JOB_TITLE NOT NULL VARCHAR2 (35) MIN_SALARY NUMBER (6) MAX_SALARY NUMBER (6) Mark for Review SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary FROM employees e NATURAL JOIN jobs j USING (job_id); SELECT first_name, last_name, job_id, min_salary, max_salary FROM employees NATURAL JOIN jobs; (*) SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary FROM employees e NATURAL JOIN jobs j; SELECT first_name, last_name, job_id, min_salary, max_salary FROM employees e FULL JOIN jobs j (job_id); SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary FROM employees e NATURAL JOIN jobs j ON (e.job_title = j.job_title); Test: Quiz: Group Functions Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. What two group functions can be used with any datatype? Mark for Review STDDEV, VARIANCE SUM, AVG

Page 141: finalkit

COUNT, SUM MIN, MAX (*) 2. What would the following SQL statement return? SELECT MAX(hire_date) FROM employees; Mark for Review The hire date of the longest serving employee The hire date of the newest employee (*) The hire dates of all employees in ascending order The hire dates of all employees 3. You can use GROUP functions in all clauses of a SELECT statement. True or False? Mark for Review True False (*) 4. The following statement will work even though it uses the same column with different GROUP functions: SELECT AVG(salary), MAX(salary), MIN(salary), SUM(salary) FROM employees; True or False? Mark for Review True (*) False 5. Given the following data in the employees table (employee_id, salary, commission_pct) DATA: (143, 2600, null 144, 2500, null 149, 10500, .2 174, 11000, .3 176, 8600, .2 178, 7000, .15) What is the result of the following statement: SELECT AVG(commission_pct) FROM employees WHERE employee_id IN( 143,144,149,174,176,178) Mark for Review

Page 142: finalkit

1.2125 This statement is invalid 0.2125 (*) 0.0425 6. Given the following data in the employees table (employee_id, salary, commission_pct) DATA: (143, 2600, null 144, 2500, null 149, 10500, .2 174, 11000, .3 176, 8600, .2 178, 7000, .15) What is the result of the following statement: SELECT SUM(commission_pct), COUNT(commission_pct) FROM employees WHERE employee_id IN( 143,144,149,174,176,178) Mark for Review SUM = .85 and COUNT = 6 SUM = 1.85 and COUNT = 6 SUM = .85 and COUNT = 4 (*) SUM = 1.85 and COUNT = 4 Test: Quiz: Count, Distinct, NVL Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. To include null values in the calculations of a group function, you must: Mark for Review Precede the group function name with NULL Count the number of null values in that column using COUNT Convert the null to a value using the NVL( ) function (*) Group functions can never use null values 2. What would the following SQL statement return? SELECT COUNT(first_name)

Page 143: finalkit

FROM employees; Mark for Review A listing of all non-null first names in the employees table The total number of non-null first names in the employees table (*) The total number of rows in the employees table A listing of all unique first names in the employees table 3. What would the following SQL statement return? SELECT COUNT(DISTINCT salary) FROM employees; Mark for Review A listing of all unique salaries in the employees table The total number of rows in the employees table The total amount of salaries in the employees table The number of unique salaries in the employees table (*) 4. Using your existing knowledge of the employees table, would the following two statements produce the same result? SELECT COUNT(*) FROM employees; SELECT COUNT(commission_pct) FROM employees; Mark for Review The first statement is invalid Yes No (*) The second statement is invalid

Page 144: finalkit

Test: Quiz: Group By and Having Clauses, ROLLUP and CUBE Operations, and Grouping Sets 1. Read the following SELECT statement. Choose the column or columns that must be included in the GROUP BY clause. SELECT COUNT(last_name), grade, gender FROM STUDENTS GROUP_BY ?????; last_name last_name, grade grade, gender (*) last_name, gender 2. Is the following statement ? SELECT department_id, AVG(salary) FROM employees; No, because a GROUP BY department_id clause is needed (*) No, because the SELECT clause cannot contain both individual columns and group functions No, because the AVG function cannot be used on the salary column Yes 3. Which of the following SQL statements could display the number of people with the same last name: SELECT first_name, last_name, COUNT(employee_id) FROM EMPLOYEES GROUP BY last_name; SELECT employee_id, COUNT(last_name) FROM EMPLOYEES GROUP BY last_name; SELECT last_name, COUNT(last_name) FROM EMPLOYEES GROUP BY last_name;

Page 145: finalkit

(*) SELECT employee_id, DISTINCT(last_name) FROM EMPLOYEES GROUP BY last_name; 4. How would you alter the following query to list only employees where more than one employee exists with the same last_name: SELECT last_name, COUNT(employee_id) FROM EMPLOYEES GROUP BY last_name; SELECT last_name, COUNT(employee_id) FROM EMPLOYEES WHERE COUNT(*) > 1 GROUP BY last_name SELECT last_name, COUNT(last_name) FROM EMPLOYEES GROUP BY last_name HAVING COUNT(last_name) > 1; (*) SELECT last_name, COUNT(last_name) FROM EMPLOYEES GROUP BY last_name EXISTS COUNT(last_name) > 1; SELECT employee_id, DISTINCT(last_name) FROM EMPLOYEES GROUP BY last_name HAVING last_name > 1; 5. Is the following statement : SELECT first_name, last_name, salary, department_id, COUNT(employee_id) FROM employees WHERE department_id = 50 GROUP BY last_name, first_name, department_id; Yes No, beause you cannot have a WHERE-clause when you use group functions.

Page 146: finalkit

No, because the statement is missing salary in the GROUP BY clause (*) Yes, because Oracle will any mistakes in the statement itself 6. The following is a valid statement: SELECT MAX(AVG(salary)) FROM employees GROUP BY department_id; True or False? True (*) False 7. The use of GROUP BY GROUPING SETS(....) can speed up the execution of complex report statements? (True or False) True (*) False 8. Examine the following statement: SELECT department_id, manager_id, job_id, SUM(salary) FROM employees GROUP BY GROUPING SETS(.......); Select the GROUP BY GROUPING SETS clause from the following list: GROUP BY GROUPING SETS (department_id, AVG(salary)), (department_id, job_id), (department_id, manager_id) GROUP BY GROUPING SETS (department_id, salary), (department_id, job_id), (department_id, manager_id) GROUP BY GROUPING SETS ((department_id, manager_id), (department_id, job_id), (manager_id, job_id)) (*) GROUP BY GROUPING SETS ((department_id, manager_id), (department_id, SUM(salary), (manager_id, job_id)) 9. If you want to include subtotals and grant totals for all columns mentioned in a GROUP BY clause you should use which of the following extensions to the GROUP BY clause? ROLLUP CUBE (*)

Page 147: finalkit

GROUP BY ALL COLUMNS HAVING 10. Examine the following statement: SELECT department_id, manager_id, job_id, SUM(salary) FROM employees GROUP BY ROLLUP(department_id, manager_id) What extra data will this query generate? Subtotals for department_id, and grand totals for salary. Subtotals for department_id, job_id and grand totals for salary. Subtotals for department_id, job_id, manager_id and grand totals for salary. The statement will fail. (*) 11. Examine the following statement: SELECT department_id, manager_id, job_id, SUM(salary) FROM employees GROUP BY GROUPING SETS((department_id, manager_id), (department_id, job_id)) What data will this query generate? Total salaries for (department_id, job_id) and (department_id, manager_id) (*) Total salaries for (department_id, job_id, manager_id) Total for (job_id, manager_id) The statement will fail. Test: Quiz: Subqueries 1. Which of the following statements is a true guideline for using subqueries? Do not enclose the subquery in parentheses.

Page 148: finalkit

Place the subquery on the left side of the comparison condition. The outer and inner queries can reference more than one table. They can get data from different tables. (*) Only one WHERE clause can be used for a SELECT statement, and if specified, it must be the outer query. 2. Subqueries can only be placed in the WHERE clause. True or False? True False (*) 3. What will the following statement return: SELECT last_name, salary FROM employees WHERE salary < (SELECT salary FROM employees WHERE employee_id = 103) A list of last_names and salaries of employees that makes more than employee 103 A list of last_names and salaries of employees that makes less than employee 103 (*) A list of first_names and salaries of employees making less than employee 103 Nothing. It is an invalid statement. 4. What will the following statement return: SELECT employee_id, last_name FROM employees WHERE salary = (SELECT MIN(salary) FROM employees GROUP BY department_id); Nothing. It is an invalid statement. (*) A list of last_names and salaries of employees A list of first_names and salaries of employees in Department 50 A list of last_names and salaries of employees grouped by department_id. 5. What will the following statement return: SELECT last_name, salary FROM employees

Page 149: finalkit

WHERE (department_id, job_id) IN (SELECT (department_id, job_id) FROM employees WHERE employee_id = 103) A list of last_names and salaries of employees that works in the same department and has the same job_id as that of employee 103. (*) A list of last_names or salaries of employees that works in the same department and has the same job_id as that of employee 103. A list of last_names and salaries of employees that works in the same department or has the same job_id as that of employee 103. Nothing. It is an invalid statement. 6. Examine the following statement: SELECT last_name, salary FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE employee_id = 103) AND job_id = (SELECT job_id FROM employees WHERE employee_id = 103) Is this a pair-wise or non-pair-wise Subquery? This is an example of a non-pair-wise subquery. (*) This is an example of a pair-wise subquery. Neither. This statement is illegal, and will not run. Test: Quiz: Single-Row Subqueries 1. In a non-correlated subquery, the outer query always executes prior to the inner query's execution. True or False? True False (*) 2. The result of this statement will be: SELECT last_name, job_id, salary, department_id FROM employees WHERE job_id = (SELECT job_id

Page 150: finalkit

FROM employees WHERE employee_id = 141) AND department_id = (SELECT department_id FROM departments WHERE location_id =1500) All employees from Location 1500 will be displayed An error since you can?t get data from two tables in the same subquery All employees with the department id of 141 Only the employees whose job id matches employee 141 and who work in location 1500 (*) 3. Subqueries are limited to four per SQL transaction. True or False? True False (*) 4. Single row subqueries may not include this operator: ALL (*) = <> > 5. If the subquery returns no rows will the outer query return any values? No, because you are not allowed to not return any rows from a subquery Yes. It will just run and ignore the subquery No, because the subquery will be treated like a null value. (*) Yes, Oracle will find the nearest value and rewrite your statement implicitly when you run it Test: Quiz: Multiple-Row Subqueries

Page 151: finalkit

1. There can be more than one subquery returning information to the outer query. True or False? True (*) False 2. Group functions can be used in subqueries even though they may return many rows. True or False? True (*) False 3. Multiple-row subqueries must have NOT, IN or ANY in the WHERE clause of the inner query. True or False? True False (*) 4. Group functions, such as HAVING and GROUP BY can be used in multiple-row subqueries. True or False? True (*) False 5. The salary column of the f_staffs table contains the following values: 4000 5050 6000 11000 23000 Which of the following statements will return the last_name and first_name of those employees who earn more than 5000. SELECT last_name, first_name FROM f_staffs WHERE salary = (SELECT salary FROM f_staffs WHERE salary > 5000); SELECT last_name, first_name FROM f_staffs WHERE salary = (SELECT salary FROM f_staffs WHERE salary < 5000); <p> SELECT last_name, first_name FROM f_staffs

Page 152: finalkit

WHERE salary IN (SELECT salary FROM f_staffs WHERE salary > 5000); (*) SELECT last_name, first_name FROM f_staffs WHERE salary IN (SELECT last_name, first_name FROM f_staffs WHERE salary < 5000); 6. When a multiple-row subquery uses the NOT IN (<>ALL) operator, if one of the values returned by the inner query is a null value, the entire query returns: A list of Nulls All rows that were selected by the inner query including the null value(s) All rows, minus the null value(s), that were selected by the inner query No rows returned (*) 7. The SQL multiple-row subquery extends the capability of the single-row syntax through the use of what three comparison operators? IN, ANY and EQUAL IN, ANY and ALL (*) IN, ANY and EVERY IN, ALL and EVERY 8. In a subquery the ALL operator compares a value to every value returned by the inner query. True or False? True (*) False Test: Quiz: Correlated Subqueries 1. In a correlated subquery the outer and inner query are joined on one or more columns? (True or False) True (*)

Page 153: finalkit

False 2. The WITH-clause is a way of creating extra tables in the database? (True or False) True False (*) 3. Correlated Subqueries must work on the same tables in both the inner and outer query? (True or False) True False (*) 4. Table aliases must be used when you are writing correlated subqueries? (True or false) True (*) False Test: Quiz: Using SET Operators 1. Which ones of the following are SET operators? (choose two) (Choose all answers) UNION, MINUS (*) UNION ALL, PLUS ALL UNION ALL, INTERSECT (*) MINUS, PLUS 2. The difference between UNION and UNION ALL is There is no difference between, you get exactly the same result. UNION will remove duplicates, UNION ALL returns all rows from all queries (*) UNION ALL is like a NATURAL JOIN

Page 154: finalkit

UNION is a synomym for UNION ALL 3. MINUS will give you rows from the first query not present in the second query? (True or False) True (*) False 4. INTERSECT will give you rows found in both queries? (True or False) True (*) False Test: Quiz: Insert Statement 1. DML is an acronym that stands for: Debit Markup Language Don't Manipulate Language Data Markup Language Data Manipulation Language (*) . Which of the following statements will add a new customer to the customers table in the Global Fast Foods database? INSERT IN customers (id, first_name, last_name, address, city, state, zip, phone_number); INSERT INTO customers (id, first_name, last_name, address, city, state, zip, phone_number) VALUES ("145", 'Katie', 'Hernandez', '92 Chico Way', 'Los Angeles', 'CA', "98008", "8586667641"); INSERT INTO customers (id, first_name, last_name, address, city, state, zip, phone_number) VALUES (145, 'Katie', 'Hernandez', '92 Chico Way', 'Los Angeles', 'CA', 98008, 8586667641); (*) INSERT INTO customers

Page 155: finalkit

(id 145, first_name 'Katie', last_name 'Hernandez', address '92 Chico Way', city 'Los Angeles', state 'CA', zip 98008, phone_number 8586667641); . To return a table summary on the customers table, which of the following is ? SHOW customers, or SEE customers DISTINCT customers, or DIST customers DESCRIBE customers, or DESC customers (*) DEFINE customers, or DEF customers 4. When inserting a new row the null keyword can be included in the values list for any null column. True or False? True (*) False 5. When inserting rows into a table all columns must be given values. True or False? True False (*) 6. Is it possible to insert more than one row at a time using an INSERT statement with a VALUES clause? No, you can only create one row at a time when using the VALUES clause. (*) Yes, you can just list as many rows as you want, just remember to separate the rows with commas. No, there is no such thing as INSERT ... VALUES. 7. Insert statements can be combined with subqueries to create more than one row per statement. True or False? True (*) False 8. If the employees table have 7 rows how many rows are inserted into the copy_emps table with the following statement: INSERT INTO copy_emps (employee_id, first_name, last_name, salary, department_id) SELECT employee_id, first_name, last_name, salary, department_id

Page 156: finalkit

FROM employees No rows, as you cannot use subqueries in an insert statement. 7 rows, as there is no WHERE-clause on the subquery. (*) No rows, as the SELECT statement is invalid. 10 rows will be created. 9. What is the quickest way to use today's date when you are creating a new row? Simply write today's date in the format of 'dd-mon-rr'. Simply use the keyword DATE in the insert statement. Use the SYSDATE function. (*) Use the TODAYS_DATE function. Test: Quiz: Updating Column Values and Deleting Rows 1. To change an existing row in a table, you can use the UPDATE or INSERT statements. True or False? True False (*) 2. Which of the following statements best describes what will happen to the student table in this SQL statement? UPDATE students SET lunch_number = (SELECT lunch_number FROM student WHERE student_id = 17) WHERE student_id = 19; The statement updates the student_table by replacing student id 19's lunch number with student id 17's lunch number. (*) Inserts a new row into the students table.

Page 157: finalkit

Does nothing, the as you cannot use subqueries in update statements. Deletes student 17's lunch_number and inserts a new value from student 19. 3. Using your knowledge of the employees table, what would be the result of the following statement: DELETE FROM employees; Nothing, no data will be changed. All rows in the employees table will be deleted if there are no constraints on the table. (*) The first row in the employees table will be deleted. Deletes employee number 100. 4. Is the following statement valid, i.e. is it allowed to update rows in one table, based on a subquery from another table? UPDATE copy_emp SET department_id = (SELECT department_id FROM employees WHERE employee_id = 100) WHERE job_id = (SELECT job_id FROM employees WHERE employee_id = 200); Yes, this is a perfectly valid statement. (*) The statement will fail, because the subqueries are returning data from different rows No, this will not work No, this statement will return an error. 5. Assuming there are no Foreign Keys on the EMPLOYEES table, if the following subquery returns one row, how many rows will be deleted from the EMPLOYEES table? DELETE FROM employees WHERE department_id = (SELECT department_id FROM departments WHERE department_name LIKE '%Public%'); No rows will be deleted. One row will be deleted, as the subquery only returns one row.

Page 158: finalkit

All the rows in the EMPLOYEES table with department_ids matching the department_id returned by the subquery. (*) All rows in the EMPLOYEES table will be deleted, regardless of their department_id. 6. How many rows will be deleted from the employees table with the following statement? DELETE FROM employees WHERE last_name = 'king'; All the rows in the employees table will be deleted. No rows will be deleted, as no employees match the WHERE-clause. (*) One will be deleted, as there exists one employee called King. All rows with last_name = 'King' will be deleted. 7. If the subquery returns one row, how many rows will be deleted from the employees table? DELETE FROM employees WHERE department_id = (SELECT department_id FROM departments WHERE department_name LIKE '%Public%'); No rows will be deleted. One row will be deleted, as the subquery only returns one row. All rows in the employees table which work in the given department will be deleted. (*) All rows in the employees table will be deleted, no matter their department_id. 8. If you are performing an UPDATE statement with a subquery, it MUST be a correlated subquery? (True or False) True False (*) 9. DELETE statements can use correlated subqueries? (True or False) True (*) False Test: Quiz: Default Values, Merge, and Multi-Table Inserts

Page 159: finalkit

1. Which statement below will not insert a row of data onto a table? INSERT INTO student_table (id, lname, fname, lunch_num) VALUES (143354, 'Roberts', 'Cameron', 6543); INSERT INTO student_table VALUES (143354, 'Roberts', 'Cameron', 6543); INSERT INTO student_table (id, lname, fname, lunch_num) VALUES (143352, 'Roberts', 'Cameron', DEFAULT); INSERT INTO (id, lname, fname, lunch_num) VALUES (143354, 'Roberts', 'Cameron', 6543); (*) 2. The MERGE function combines the: CREATE and UPDATE commands INSERT and UPDATE commands (*) ALTER and UPDATE commands all of the above 3. In developing the Employees table, you create a column called hire_date. You assign the hire_date column a DATE datatype with a DEFAULT value of 0 (zero). A user can come back later and enter the hire_date. This is __________. A great idea. When a new employee record is entered, if no hire_date is specified, the 0 (zero) will be automatically specified. A great idea. When new employee records are entered, they can be added faster by allowing the 0's (zeroes) to be automatically specified. Both a and b are . A bad idea. The default value must match the DATE datatype of the column. (*) 4. If a default value was set for a null column, Oracle sets the column to the default value. However, if no default value was set when the column was created, Oracle inserts an empty space. True or False?

Page 160: finalkit

True False (*) 5. The MERGE statement can be used to update rows in one table based on values in another table and if the update fails, then the rows will automatically be inserted instead. True or False? True (*) False 6. The DEFAULT keyword can be used in the following statements: INSERT and UPDATE (*) INSERT and DELETE DELETE and UPDATE All of the above 7. A multi-table insert statement must have a subquery at the end of the statement? (True or False) True (*) False 8. A multi-table insert statement can insert into more than one table? (True or False) True (*) False Test: Quiz: Creating Tables Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. I have a table named School_Friends in my schema. You want to build a table in your schema named School_Friends. This is ______________, because ____________________________________. Mark for Review possible; my schema is separate from yours, and it is okay for us to have like-named tables in our separate schemas. (*)

Page 161: finalkit

possible; our data will merge into one table, and we can more easily access our mutual friends information. impossible; no matter what, there can never be two tables with the same name, even if they are in separate schemas. impossible; School_Friends is a reserved term in SQL. 2. DCL, which is the acronym for Data Control Language, allows: Mark for Review the ALTER command to be used. a Database Administrator the ability to grant privileges to users. (*) the TRUNCATE command to be used. the CONTROL TRANSACTION statement can be used. 3. It is possible to create a table by using the CREATE TABLE command in conjunction with a subquery. True or False? Mark for Review True (*) False 4. CREATE TABLE bioclass (hire_date DATE DEFAULT SYSDATE, first_name varchar2(15), last_name varchar2(15)); The above CREATE TABLE statement is acceptable, and will create a Table named bioclass that contains a hire_date, first_name and last_name column. True or False? Mark for Review True (*) False

Page 162: finalkit

5. When creating a new table, which of the following naming rules apply: (Choose three) Mark for Review (Choose all correct answers) Must begin with a letter (*) Can have the same name as another object owned by the same user Must contain ONLY A - Z, a - z, 0 - 9, _ (underscore), $, and # (*) Must be an Oracle reserved word Must be between 1 and 30 characters long (*) 6. CREATE TABLE student_table (id NUMBER(6), lname VARCHAR(20), fname VARCHAR(20), lunch_num NUMBER(4)); Which of the following statements best describes the above SQL statement: Mark for Review creates a table named student_table with four columns: lname, fname, lunch, num creates a table named student with four columns: id, lname, fname, lunch_num creates a table named student_table with four columns: id, lname, fname, lunch_num (*) creates a table named student_table with four columns: lname, fname, lunch, num 7. Given this employee table: (employee_id NUMBER(10) NOT NULL, first_name VARCHAR2(25) NOT NULL, last_name VARCHAR2(30) NOT NULL, hire_date DATE DEFAULT sysdate) What will be the result in the hire_date column following this insert statement:

Page 163: finalkit

INSERT INTO employees VALUES (10, 'Natacha', 'Hansen', DEFAULT); Mark for Review Statement will fail, as you must list the columns into which you are inserting. Statement will work and the hire_date column will have the value of the date when the statement was run. (*) The character string SYSDATE. The column for hire_date will be null. 8. Examine this CREATE TABLE statement: CREATE TABLE emp_load (employee_number CHAR(5), employee_dob CHAR(20), employee_last_name CHAR(20), employee_first_name CHAR(15), employee_middle_name CHAR(15), employee_hire_date DATE) ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY def_dir1 ACCESS PARAMETERS (RECORDS DELIMITED BY NEWLINE FIELDS (employee_number CHAR(2), employee_dob CHAR(20), employee_last_name CHAR(18), employee_first_name CHAR(11), employee_middle_name CHAR(11), employee_hire_date CHAR(10) date_format DATE mask "mm/dd/yyyy“)) LOCATION ('info.dat')); What kind of table is created here? Mark for Review An external table with the data stored in a file outside the database. (*) A View. An external table with the data stored in a file inside the database. None. This is in invalid statement.

Page 164: finalkit

9. Once they are created, external tables are accessed with normal SQL statements? (True or False) Mark for Review True (*) False Test: Quiz: Using Data Types Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. INTERVAL DAY TO SECOND stores a period of time in terms of days, hours, minutes, and seconds. True or False? Mark for Review True (*) False 2. To store large amounts of text you should simply create a series of VARCHAR2 columns in a table. True or False? Mark for Review True False (*) 3. The BLOB datatype can hold a maximum of 128 Terabytes of data. True or False? Mark for Review True (*) False 4. Which of the following are valid Oracle datatypes? Mark for Review DATE, BLOB, LOB, VARCHAR2 DATE, TIMESTAMP WITH LOCAL TIMEZONE, BLOB (*) TIMESTAMP, LOB, VARCHAR2, NUMBER

Page 165: finalkit

SYSDATE, TIMESTAMP, DATE, LOCAL TIMEZONE Test: Quiz: Modifying a Table Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. When you use ALTER TABLE to add a column, the new column: Mark for Review Becomes the first column in the table Becomes the last column in the table (*) Can be placed by adding a GROUP BY clause Will not be created because you cannot add a column after the table is created 2. To completely get rid of a table, its contents, its structure, AND release the storage space the keyword is: Mark for Review DROP (*) DELETE TRUNCATE KILL 3. Comments can be added to a table by using the COMMENT ON TABLE statement. The comments being added are enclosed in: Mark for Review Double quotes " " Single quotes ' ' (*) Parentheses ( ) Brackets { }

Page 166: finalkit

4. A column?s data type can always be changed from NUMBER to VARCHAR2 but not from VARCHAR2 to NUMBER, provided the table is empty. True or False? Mark for Review True False (*) 5. You can use DROP COLUMN to drop all columns in a table, leaving a table structure with no columns. True or False? Mark for Review True False (*) 6. After issuing a SET UNUSED command on a column, another column with the same name can be added using an ALTER TABLE statement. True or False? Mark for Review True (*) False 7. When should you use the SET UNUSED command? Mark for Review Never, there is no SET UNUSED command You should use it if you think the column may be needed again later You should use it when the system is being heavily used (*) You should only use this command if you want the column to still be visible when you DESCRIBE the table 8. The following code creates a table named student_table with four columns: id, lname, fname, lunch_num CREATE TABLE student_table (id NUMBER(6), lname VARCHAR(20), fname VARCHAR(20), lunch_num NUMBER(4));

Page 167: finalkit

The lunch_num column in the above table has been marked as UNUSED. Which of the following is the best statement you can use if you wish to remove the UNUSED column from the student_table? Mark for Review DROP column ALTER TABLE DELETE UNUSED COLUMNS ALTER TABLE DROP UNUSED COLUMNS (*) ALTER TABLE DELETE ALL COLUMNS 9. You can use the ALTER TABLE statement to: Mark for Review Add a new column Modify an existing column Drop a column All of the above (*) 10. Which of the following will correctly change the name of the LOCATIONS table to NEW_LOCATIONS? Mark for Review ALTER TABLE LOCATIONS RENAME NEW_LOCATIONS MODIFY TABLE LOCATIONS RENAME NEW_LOCATIONS RENAME LOCATIONS TO NEW_LOCATIONS (*) None of the above; you cannot rename a table, you can only CREATE, ALTER and DROP a table. 11. The data type of a column can never be changed once it has been created. True or False? Mark for Review True

Page 168: finalkit

False (*) 12. ALTER TABLE table_name RENAME can be used to: Mark for Review Rename a row. Rename a column. Rename a table. (*) All of the above. 13. The FLASHBACK QUERY statement can restore data back to a point in time before the last COMMIT. True or False? Mark for Review True False (*) 14. The FLASHBACK TABLE to BEFORE DROP can restore only the table structure, but not its data back to before the table was dropped. True or False? Mark for Review True False (*) Test: Quiz: Defining Not Null and Unique Constraints Answer the question(s) on this page, and click Next to go to the next test page. Click Summary to see which questions you need to answer before submitting the test. Click Finish Test if you are ready to submit your test. 1. A unique key constraint can only be defined on a not null column. True or False? Mark for Review True False (*)

Page 169: finalkit

2. A table can have more than one UNIQUE key constraint. True or False? Mark for Review True (*) False 3. A column defined as NOT NULL can have a DEFAULT value of NULL. True or False? Mark for Review True False (*) 4. If the employees table has a UNIQUE constraint on the DEPARTMENT_ID column, we can only have one employee per department. True or False? Mark for Review True (*) False 5. A table must have at least one not null constraint and one unique constraint. True or False? Mark for Review True False (*) 6. Which of the following is not a valid Oracle constraint type? Mark for Review UNIQUE KEY NOT NULL EXTERNAL KEY (*) PRIMARY KEY

Page 170: finalkit

Test: Quiz: Creating Views Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. Views contain no data of their own. True or False? Mark for Review True (*) False 2. What is one advantage of using views? Mark for Review To provide data dependence To be able to store the same data in more than one place To provide restricted data access (*) 3. Any select statement can be stored in the database as a view. True or False Mark for Review True (*) False 4. Given the following CREATE VIEW statement, what data will be returned? CREATE OR REPLACE VIEW emp_dept AS SELECT SUBSTR(e.first_name,1,1) ||' '||e.last_name emp_name, e.salary, e.hire_date, d.department_name FROM employees e, departments d WHERE e.department_id = d.department_id AND d.department_id >=50; Mark for Review

Page 171: finalkit

First character from employee first_name concatenated to the last_name, the salary, the hire_date and department_id of all employees working in department number 50 or higher. First character from employee first_name concatenated to the last_name, the salary, the hire_date and department_id of all employees working in department number 50. First character from employee first_name concatenated to the last_name, the salary, the hire_date and department_name of all employees working in department number 50. First character from employee first_name concatenated to the last_name, the salary, the hire_date and department_name of all employees working in department number 50 or higher. (*) 5. A view can contain group functions. True or False? Mark for Review True (*) False 6. A view can contain a select statement with a subquery. True or False? Mark for Review True (*) False Test: Quiz: Primary Key, Foreign Key, and Check Constraints Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. The main reason that constraints are added to a table is: Mark for Review Constraints add a level of complexity Constraints ensure data integrity (*) Constraints gives programmers job security

Page 172: finalkit

None of the Above 2. A Primary Key that is made up of more than one column is called a: Mark for Review Multiple Primary Key Composite Primary Key (*) Double Key Primary Multi-Key None of the Above 3. Foreign Key Constraints are also known as: Mark for Review Parental Key Constraints Child Key Constraints Referential Integrity Constraints (*) Multi-Table Constraints 4. The table that contains the Primary Key in a Foreign Key Constraint is known as: Mark for Review Child Table Parent Table (*) Detail Table Mother and Father Table 5. To automatically delete rows in a child table when a parent record is deleted use: Mark for Review

Page 173: finalkit

ON DELETE SET NULL ON DELETE ORPHAN ON DELETE CASCADE (*) None of the Above 6. The number of check constraints that can be defined on a column is: Mark for Review 10 5 100 There is no limit (*) 7. An example of adding a check constraint to limit the salary that an employee can earn is: Mark for Review ALTER TABLE employees ADD CONSTRAINT emp_salary_ck SALARY < 100000 ALTER TABLE employees CONSTRAINT emp_salary_ck CHECK(salary < 100000) MODIFY TABLE employees ADD CONSTRAINT emp_salary_ck CHECK(salary < 100000 ALTER TABLE employees ADD CONSTRAINT emp_salary_ck CHECK (salary < 100000) (*) 8. If a Primary Key is made up of more than one column, one of the columns can be null. True or False? Mark for Review True False (*)

Page 174: finalkit

9. The employees table contains a foreign key column department_id that references the id column in the departments table. Which of the following constraint modifiers will NOT allow the deletion of id values in the department table? Mark for Review ON DELETE CASCADE ON DELETE SET NULL Neither A nor B (*) Both A and B 10. Which of the following pieces of code will NOT successfully create a foreign key in the CDS table that references the SONGS table Mark for Review CONSTRAINT d_cd_ song_id_fk FOREIGN KEY (song_id)REFERENCES d_songs(id) CONSTRAINT k_cd_songid_fk FOREIGN KEY (song_id)REFERENCES d_songs(id) song_id NUMBER(5) CONSTRAINT d_cd_ song_id_fk REFERENCES d_songs(id) None of the above (*) 11. A composite primary key may only be defined at the table level. True or False? Mark for Review True (*) False Test: Quiz: Managing Constraints Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. Once constraints have been created on a table you will have to live with them as they are unless you drop and re-create the table. True or False? Mark for Review

Page 175: finalkit

True False (*) 2. The command to 'switch off' a constraint is: Mark for Review ALTER TABLE STOP CHECKING ALTER TABLE STOP CONSTRAINTS ALTER TABLE DISABLE CONSTRAINT (*) ALTER TABLE PAUSE CONSTRAINT 3. All of a user's constraints can be viewed in the Oracle Data Dictionary view called: Mark for Review USER_TABLES USER_CONSTRAINTS (*) CONSTRAINTS TABLE_CONSTRAINTS 4. You can drop a column in a table with a simple ALTER TABLE DROP COLUMN statement, even if the column is referenced in a constraint. True or False? Mark for Review True False (*) 5. What mechamisn does Oracle use in the background to enforce uniqueness in Primary and Unique key constraints? Mark for Review Ordered Lists Internal Pointers

Page 176: finalkit

Nothing extra is created when Primary Keys and Unique Keys are created Unique indexes are created in the background by Oracle when Primary and Unique constraints are created or enabled (*) Test: Quiz: Creating Views Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. Views contain no data of their own. True or False? Mark for Review True (*) False 2. What is one advantage of using views? Mark for Review To provide data dependence To be able to store the same data in more than one place To provide restricted data access (*) 3. Any select statement can be stored in the database as a view. True or False Mark for Review True (*) False 4. Given the following CREATE VIEW statement, what data will be returned? CREATE OR REPLACE VIEW emp_dept AS SELECT SUBSTR(e.first_name,1,1) ||' '||e.last_name emp_name, e.salary, e.hire_date, d.department_name FROM employees e, departments d WHERE e.department_id = d.department_id AND d.department_id >=50; Mark for Review

Page 177: finalkit

First character from employee first_name concatenated to the last_name, the salary, the hire_date and department_id of all employees working in department number 50 or higher. First character from employee first_name concatenated to the last_name, the salary, the hire_date and department_id of all employees working in department number 50. First character from employee first_name concatenated to the last_name, the salary, the hire_date and department_name of all employees working in department number 50. First character from employee first_name concatenated to the last_name, the salary, the hire_date and department_name of all employees working in department number 50 or higher. (*) 5. A view can contain group functions. True or False? Mark for Review True (*) False 6. A view can contain a select statement with a subquery. True or False? Mark for Review True (*) False Test: Quiz: DML Operations and Views Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. Which of the following DML operations is not allowed when using a Simple View created with read only? Mark for Review INSERT UPDATE

Page 178: finalkit

DELETE All of the above (*) 2. Examine the view below and choose the operation that CANNOT be performed on it. CREATE VIEW dj_view (last_name, number_events) AS SELECT c.last_name, COUNT(e.name) FROM d_clients c, d_events e WHERE c.client_number = e.client_number GROUP BY c.last_name Mark for Review CREATE OR REPLACE dj_view (last_name, number_events) AS SELECT c.last_name, COUNT(e.name) FROM d_clients c, d_events e WHERE c.client_number = e.client_number GROUP BY c.last_name; INSERT INTO dj_view VALUES ('Turner', 8); (*) SELECT last_name, number_events FROM dj_view; DROP VIEW dj_view; 3. If a database administrator wants to ensure that changes performed through a view do not violate existing constraints, which clause should he/she include when creating the view? Mark for Review WITH READ ONLY FORCE WITH CONSTRAINT CHECK WITH CHECK OPTION (*) 4. Given the following view what operations would be allowed on the emp_dept view: CREATE OR REPLACE VIEW emp_dept AS SELECT SUBSTR(e.first_name,1,1) ||' '||e.last_name emp_name, e.salary, e.hire_date, d.department_name

Page 179: finalkit

FROM employees e, departments d WHERE e.department_id = d.department_id AND d.department_id >=50; Mark for Review SELECT, DELETE SELECT, UPDATE of all columns SELECT, UPDATE of some columns, DELETE (*) SELECT, INSERT 5. Using the pseudocolumn ROWNUM in a view has no implications on the ability to do DML's through the view. True or False? Mark for Review True False (*) 6. There is only one kind view? True or False? Mark for Review True False (*) Test: Quiz: Managing Views Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. A Top-N Analysis is capable of ranking a top or bottom set of results. True or False? Mark for Review True (*) False 2. Which of these is not a valid type of View? Mark for Review INLINE

Page 180: finalkit

ONLINE (*) SIMPLE COMPLEX 3. Which of these Keywords is typically used with a Top-N Analysis? Mark for Review Rowid Rownum (*) Sequence Number 4. Which of the following is true about ROWNUM? Mark for Review It is the number assigned to each row returned from a query after they are ordered. It is the number assigned to each row returned from a query as they are read from disk. (*) It is the number of rows in a table. None of the above 5. How do you remove a view? Mark for Review DELETE VIEW view_name REMOVE VIEW view_name DROP VIEW view_name (*) You cannot remove a view 6. When you drop a table referenced by a view, the view is automatically dropped as well. True or False? Mark for Review

Page 181: finalkit

True False (*) 7. When you drop a view, the data it contains is also deleted. True or False? Mark for Review True False (*) Sectiunea 11 Test: Quiz: In Class Interview Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. When you know you are good at answering questions in interviews, there is no need to worry about your appearance or "first impressions." True or False? Mark for Review True False (*) 2. Which answer would be the best in response to an interviewer's question: "Do you have any children"? Mark for Review Yes, I have 5 children and I am a single parent. I am not required to answer that question. I know your concern about my abilities to be able to be on the job everyday, but I assure you, I took this into account when I applied for the job. (*) It's none of your business. 3. Since you are not planning to get a job until after completing college/university, you don't need to learn interview skills at this point? True or False? Mark for Review True False (*)

Page 182: finalkit

4. When applying for a job at a discount department store, wearing casual clothing would demonstrate an applicant's appropriateness for a position as a check out clerk. True or False? Mark for Review True False (*) 5. In a behavioral interview, candidates are asked about: Mark for Review Accomplishments, college, etc. Past Performance. (*) Personality traits. How much money they would like to earn. 6. In a traditional interview, candidates are asked about: Mark for Review Accomplishments, college, etc. (*) Job history. Personality traits. How much money they would like to earn. Test: Quiz: Sequences Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. A sequence is a database object. True or False? Mark for Review True (*) False

Page 183: finalkit

2. NEXTVAL and CURRVAL are known as column aliases. True or False? Mark for Review True False (*) 3. Which keyword is used to modify a sequence? Mark for Review Change. Update. Alter. (*) Create. 4. Which keyword is used to remove a sequence? Mark for Review Drop. (*) Delete. Remove. Revoke. 5. Which is the correct syntax for specifying a maximum value in a sequence? Mark for Review Maxval. Max_value. Maximumvalue. Maxvalue. (*) 6. CURRVAL is a pseudocolumn used to extract successive sequence numbers from a specified sequence. True or False? Mark for Review

Page 184: finalkit

True False (*) 7. CURRVAL is a pseudocolumn used to refer to a sequence number that the current user has just generated by referencing NEXTVAL. True or False? Mark for Review True (*) False 8. When you alter a sequence, a new increased MAXVALUE can be entered without changing the existing number order. True or False? Mark for Review True (*) False 9. A sequence is a window through which data can be queried or changed. True or False? Mark for Review True False (*) 10. Why do gaps in sequences occur? Mark for Review A rollback is executed. The system crashes. The sequence is used in another table. All of the above. (*) 11. Examine the code for creating this sequence:

Page 185: finalkit

CREATE SEQUENCE track_id_seq INCREMENT BY 10 START WITH 1000 MAXVALUE 10000 What are the first three values that would be generated by the sequence? Mark for Review 100010011002. 1000, 1010, 1020. (*) 1100, 1200, 1300. 0, 1, 2. 12. In order to be able to generate primary key values that are not likely to contain gaps, which phrase should be included in the sequence creation statement? Mark for Review NOCACHE. (*) CACHE. MAXVALUE. Test: Quiz: Indexes and Synonyms Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. In SQL what is a synonym? Mark for Review A table with the same number of columns as another table. A table with the same name as another view. A different name for a table, view or other database object. (*) A table with that must be qualified with a username.

Page 186: finalkit

2. You must use a synonym to access another users table. True or False? Mark for Review True False (*) 3. Which of the following SQL statments shows a correct syntax example of creating a synonym accessible to all users of a database? Mark for Review CREATE SYNONYM emp FOR EMPLOYEES CREATE PUBLIC SYNONYM emp FOR EMPLOYEES (*) CREATE UNRESTRICTED SYNONYM emp FOR EMPLOYEES CREATE SHARED SYNONYM emp FOR EMPLOYEES 4. All tables must have indexes on them otherwise they cannot be queried. True or False? Mark for Review True False (*) 5. What kind of INDEX is created by Oracle when you create a primary key? Mark for Review UNIQUE INDEX. (*) NONUNIQUE INDEX. INDEX. Oracle cannot create indexes automatically. 6. It is possible to have an indexed column in a table where a value in the table column does not exist in the index. True or False? Mark for Review

Page 187: finalkit

True False (*) 7. Which of the following statements best describes indexes and their use? Mark for Review They are just random copies of data in no particular order. They contain the column value and pointers to the data in the table, but the data is sorted. (*) They contain all the rows and columns from the table. None of the above. 8. Indexes can be used to speed up queries. True or False? Mark for Review True (*) False Sectiunea 12 Test: Quiz: Controlling User Access Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. Which of the following is not a database object? Mark for Review View Subquery (*) Table Sequence 2. Which of these is not a System Privilege granted by the DBA? Mark for Review

Page 188: finalkit

Create Sequence Create Index (*) Create Procedure Create Session 3. Which Object Privilege apart from Alter can be granted to a Sequence? Mark for Review SELECT (*) UPDATE INSERT DELETE 4. A Schema is a collection of Objects such as Tables, Views and Sequences. True or False? Mark for Review True (*) False 5. By Controlling User Access with Oracle Database Security you can give access to specific Objects in the Database. True or False? Mark for Review True (*) False 6. The following table shows some of the output from one of the data dictionary views. Which view is being queried? USERNAME PRIVILEGE ADMIN_OPTION USCA_ORACLE_SQL01_S08 CREATE VIEW NO USCA_ORACLE_SQL01_S08 CREATE TABLE NO USCA_ORACLE_SQL01_S08 CREATE SYNONYM NO USCA_ORACLE_SQL01_S08 CREATE TRIGGER NO USCA_ORACLE_SQL01_S08 CREATE SEQUENCE NO USCA_ORACLE_SQL01_S08 CREATE DATABASE NO

Page 189: finalkit

Mark for Review user_sys_privs (lists system privileges granted to the user) (*) user_tab_privs_recd (lists object privileges granted to the user) role_tab_privs (lists table privileges granted to roles) role_sys_privs (lists system privileges granted to roles) 7. Object privileges are: Mark for Review Required to gain access to the database. Required to manipulate the content of objects in the database. (*) Named groups of related privileges given to a user. A collection of objects, such as tables, views, and sequences. 8. A schema is: Mark for Review Required to gain access to the database. Required to manipulate the content of objects in the database. A named group of related privileges given to a user. A collection of objects, such as tables, views, and sequences. (*) 9. System privileges are: Mark for Review Required to gain access to the database. (*) Required to manipulate the content of objects in the database. Named groups of related privileges given to a user.

Page 190: finalkit

A collection of objects, such as tables, views, and sequences. 10. What system privilege must be held in order to login to an Oracle database? Mark for Review CREATE LOGIN CREATE SESSION (*) CREATE LOGON No special privilege is needed, if your username exists in the database, you can login. 11. Which of the following Object Privileges can be granted on an individual column on a table? (Choose two) Mark for Review (Choose all correct answers) Update (*) References (*) Insert Delete Test: Quiz: Creating and Revoking Object Privileges Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. What Oracle feature simplifies the process of granting and revoking privileges? Mark for Review Role (*) Object Data dictionary Schema

Page 191: finalkit

2. Scott King owns a table called employees. He issues the following statement: GRANT select ON employees TO PUBLIC; Allison Plumb has been granted CREATE SESSION by the DBA. She logs into the database and issues the following statement: GRANT select ON scott_king.employees TO jennifer_cho; True or False: Allison's statement will fail. Mark for Review True (*) False 3. User1 owns a table and grants select on it WITH GRANT OPTION to User2. User2 then grants select on the same table to User3. If User1 revokes select privileges from User2, will User3 be able to access the table? Mark for Review Yes No (*) 4. Which of the following statements about granting object privileges is false? Mark for Review To grant privileges on an object, the object must be in your own schema, or you must have been granted the object privileges WITH GRANT OPTION. An object owner can grant any object privilege on the object to any other user or role of the database. The owner of an object automatically acquires all object privileges on that object. Object privileges can only be granted through roles. (*) 5. If you are granted privileges to your friend's object, by default you may also grant access to this same object to other users. True or False? Mark for Review

Page 192: finalkit

True False (*) 6. Roles are: Mark for Review Required to gain access to the database. Required to manipulate the content of objects in the database. Named groups of related privileges given to a user or another role. (*) A collection of objects, such as tables, views, and sequences. 7. A role can be granted to another role. True or False? Mark for Review True (*) False 8. To take away a privilege from a user you use which command? Mark for Review DELETE REMOVE REVOKE (*) ALTER 9. When a user is logged into one database, they are restricted to working with objects found in that database. True or False? Mark for Review True False (*)

Page 193: finalkit

10. Database Links are always accessible to all users of a database? True or False? Mark for Review True False (*) 11. Which of the following statements is true? Mark for Review Database Links allow users to work on remote database objects without having to log into the other database. (*) Database Links are pointers to another schema in the same database. Database Links are never used in the real world. Database Links can be created by any user of a database. You do not need any special privileges to create them. Test: Quiz: Regular Expressions Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct 1. REGULAR EXPRESSIONS does exactly the same as LIKE. No more and no less? (True or False) Mark for Review True False (*) 2. REGULAR EXPRESSIONS can be used on CHAR, CLOB and VARCHAR2 datatypes? (True or False) Mark for Review True (*) False 3. Select the correct REGULAR EXPRESSION functions: (Choose two) Mark for Review (Choose all correct answers) REGEXP_LIKE, REGEXP_NEAR REGEXP_LIKE, REGEXP_REPLACE (*)

Page 194: finalkit

REGEXP_REPLACE, REGEXP_REFORM REGEXP_INSTR, REGEXP_SUBSTR (*) 4. REGULAR EXPRESSIONS can be used as a part of contraint definitions? (True or False) Mark for Review True (*) False Sectiunea 14 Test: Quiz: Database Transactions Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 1 1. You need not worry about controlling your transactions. Oracle does it all for you. True or False? Mark for Review (1) Points True False (*) 2. As soon as UserA has entered data into a table UserB has privileges to see, UserB can see that data. True or False? Mark for Review (1) Points True False (*) 3. When you log out of Oracle, your data changes are automatically rolled back. True or False? Mark for Review (1) Points True False (*) 4. If Oracle crashes your changes are automatically rolled back. True or False? Mark for Review (1) Points

Page 195: finalkit

True (*) False 5. Examine the following statements: INSERT INTO emps SELECT * FROM employees; -- 107 rows inserted. SAVEPOINT Ins_Done; DELETE employees; -- 107 rows deleted SAVEPOINT Del_Done; UPDATE emps SET last_name = 'Smith'; How would you undo the last Update only? Mark for Review (1) Points Rollback update; Rollback to savepoint Del_Done; (*) There is nothing you can do. Commit until Del_Done; 6. Examine the following Statement: INSERT INTO emps SELECT * FROM employees; -- 107 rows inserted. SAVEPOINT Ins_Done; CREATE INDEX emp_lname_idx ON employees(last_name); UPDATE emps SET last_name = 'Smith'; What happens if you issue a Rollback statement? Mark for Review (1) Points The update of last_name is undone, but the insert was committed by the CREATE INDEX statement. (*) Both the UPDATE and the INSERT will be rolled back. The INSERT is undone but the UPDATE is committed Nothing happens.

Page 196: finalkit

7. COMMIT saves all outstanding data changes? True or False? Mark for Review (1) Points True (*) False

Page 197: finalkit

Section 12 1. 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 2. 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 3. 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

Page 198: finalkit

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 (*) Incorrect. Refer to Section 12 5. In a physical data model, an attribute becomes a _____________. Mark for Review (1) Points Table Foreign Key Constraint Column (*) Correct 6. 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

Page 199: finalkit

Unique Keys, Primary keys Correct 7. 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 (*) Correct 8. It is possible to implement non-transferability via a simple Foreign Key Relationship. True or False? Mark for Review (1) Points True False (*) Correct 9. Many to many relationships are implemented via a structure called a: ________________ Mark for Review (1) Points Supertype Intersection Table (*) Intersection Entity

Page 200: finalkit

Subtype Incorrect. Refer to Section 12 10. 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 Section 12 11. 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 Section 13 12. The _______ clause can be added to a SELECT statement to return a subset of the data. Mark for Review (1) Points

Page 201: finalkit

ANYWHERE WHICH WHERE (*) EVERY Correct. 13. The DESCRIBE command returns all rows from a table. True or False? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 13 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. You query the database with this SQL statement: SELECT *

Page 202: finalkit

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 Incorrect. See Section 16 16. Evaluate this SELECT statement: SELECT (salary * raise_percent) raise FROM employees; If the RAISE_PERCENT column only contains null values, what will the statement return? 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. 17. What would you use in the SELECT clause to return all the columns in the table? Mark for Review (1) Points An asterisk (*) (*)

Page 203: finalkit

A minus sign (-) A plus sign (+) The ALL keyword Correct. 18. 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. 19. In a SELECT clause, what is the result of 2 + 3 * 2? Mark for Review (1) Points 6 8 (*) 10 13 Correct. 20. You query the database with this SQL statement: SELECT * FROM students; Why would you use this statement?

Page 204: finalkit

Mark for Review (1) Points To insert data To view data (*) To display the table structure To delete data Correct. Section 16 21. Any Non-UID must be dependant on the entire UID. True or False? Mark for Review (1) Points True (*) False Correct 22. 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. Incorrect. Refer to Section 6

Page 205: finalkit

Section 17 23. What does the DISTINCT keyword do when it is used in a SELECT clause? Mark for Review (1) Points Hides NULL values Eliminates all unique values and compares values Eliminates duplicate rows in the result (*) Eliminates only unique rows in the result Correct. See Section 17 24. Which symbol represents the not equal to condition? Mark for Review (1) Points # '+' != (*) ~ Correct. 25. 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.

Page 206: finalkit

Correct. See Section 17 26. Which operator is used to combine columns of character strings to other columns? Mark for Review (1) Points * / + || (*) Correct. See Section 17 27. 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. 28. 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

Page 207: finalkit

IS Correct. 29. Evaluate this SELECT statement: SELECT * FROM employees WHERE department_id IN(10, 20, 30) AND salary > 20000; Which values would cause the logical condition to return TRUE? Mark for Review (1) Points DEPARTMENT_ID = 10 and SALARY = 20000 DEPARTMENT_ID = 20 and SALARY = 20000 DEPARTMENT_ID = null and SALARY = 20001 DEPARTMENT_ID = 10 and SALARY = 20001 (*) Correct. See Section 17 30. What will the result of the following SELECT statement be: SELECT last_name, salary, salary + 300 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 Display the last name, salary and the results of adding 300 to each salary for 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 the new salary.

Page 208: finalkit

Display the last name, salary and the results of adding 300 to the salary of the first employee row Correct. See Section 17 Section 17 31. 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. 32. You need write a SELECT statement that should only return rows that contain 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 values? Mark for Review (1) Points = !=

Page 209: finalkit

IN (*) BETWEEN..AND.. Correct. 33. 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. 34. 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

Page 210: finalkit

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 35. 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. Incorrect. See Section 17 36. The EMPLOYEES table includes these columns: EMPLOYEE_ID NUMBER(4) NOT NULL LAST_NAME VARCHAR2(15) NOT NULL FIRST_NAME VARCHAR2(10) NOT NULL HIRE_DATE DATE NOT NULL You want to produce a report that provides the first names, last names and hire dates of those employees who were hired between March 1, 2000, and August 30, 2000. Which statements can you issue to accomplish this task? Mark for Review

Page 211: finalkit

(1) Points SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '01-MAR-00' AND '30-AUG-00'; (*) SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '30-AUG-00' AND '01-MAR-00'; SELECT last_name, first_name, hire_date FROM employees GROUP BY hire_date >= '01-MAR-00' and hire_date <= '30- AUG-00'; SELECT last_name, first_name, hire_date FROM employees AND hire_date >= '01-MAR-00' and hire_date <= '30-AUG- 00'; Correct. Section 18 37. 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.

Page 212: finalkit

Include a HAVING clause. 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 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;

Page 213: finalkit

Correct. 39. Evaluate this SELECT statement: SELECT * FROM employees WHERE salary > 30000 AND department_id = 10 OR email IS NOT NULL; Which statement is true? Mark for Review (1) Points 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. 40. 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 ...

Page 214: finalkit

Incorrect! See Section 18. Section 18 41. 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? Mark for Review (1) Points 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'; (*)

Page 215: finalkit

Incorrect! See Section 18. 42. 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 18. 43. 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? Mark for Review (1) Points SELECT employee_id, last_name, first_name, salary 'Yearly Salary' (*) FROM employees WHERE salary IS NOT NULL ORDER BY last_name, 3;

Page 216: finalkit

Correct. 44. Evaluate this SELECT statement: SELECT last_name, first_name, department_id, manager_id FROM employees; 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? Mark for Review (1) Points 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. 45. 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. 46. Which comparison condition means "Less Than or Equal To?" Mark for Review (1) Points "=)" "+<"

Page 217: finalkit

">=" "<=" (*) Correct. 47. From left to right, what is the correct order of Precedence? Mark for Review (1) Points Arithmetic, Concatenation, Comparison, OR (*) NOT, AND, OR, Arithmetic Arithmetic, NOT, Logical, Comparison Arithmetic, NOT, Concatenation, Logical Correct. 48. 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. 49. 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 (*)

Page 218: finalkit

WHERE FROM HAVING Correct. 50. 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? Mark for Review (1) Points DESC (*) ASC SORT CHANGE Correct.

Page 219: finalkit

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

Page 220: finalkit

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

Page 221: finalkit

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

Page 222: finalkit

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

Page 223: finalkit

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

Page 224: finalkit

(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;

Page 225: finalkit

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

Page 226: finalkit

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;

Page 227: finalkit

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

Page 228: finalkit

(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;

Page 229: finalkit

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;

Page 230: finalkit

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)

Page 231: finalkit

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

Page 232: finalkit

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

Page 233: finalkit

(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;

Page 234: finalkit

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

Page 235: finalkit

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.

Page 236: finalkit

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?

Mark for Review (1) Points

DESC (*)

ASC

SORT

CHANGE

Correct.

Page 237: finalkit

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;

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?

Mark for Review (1) Points

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?

Mark for Review (1) Points

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.

47. Evaluate this SELECT statement:

Mark for Review

Page 238: finalkit

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?

(1) Points

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";

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.

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?

Mark for Review (1) Points

SELECT employee_id, last_name, first_name, salary 'Yearly Salary' (*)

Page 239: finalkit

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?

Mark for Review (1) Points

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.

Page 240: finalkit

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

Page 241: finalkit

(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

Page 242: finalkit

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

Page 243: finalkit

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

Page 244: finalkit

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

Page 245: finalkit

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?

Page 246: finalkit

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 6 8 (*) 10 13 Correct. Section 16

Page 247: finalkit

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

Page 248: finalkit

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;

Page 249: finalkit

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.

Page 250: finalkit

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.

Page 251: finalkit

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

Page 252: finalkit

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

Page 253: finalkit

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.

Page 254: finalkit

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.

Page 255: finalkit

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.

Page 256: finalkit

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;

Page 257: finalkit

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.

Page 258: finalkit

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.

Page 259: finalkit

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

Page 260: finalkit

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.