Oracle Database Design Final Exam

Section 11 (Answer all questions in this section) 1. In an Oracle database, why would 1_TABLE not work as a table name?

Views 238 Downloads 1 File size 137KB

Report DMCA / Copyright

DOWNLOAD FILE

Recommend stories

Citation preview

Section 11 (Answer all questions in this section) 1. 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 2. 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 3. 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 4. To resolve a many to many relationship in a physical model you create a/an ___________________?

Mark for Review (1) Points

Unique key constraints Intersection entity Intersection table (*)

Two tables with Foreign key constraints between them Correct 5. In a conceptual model, many-to-many relationships are resolved via a structure called a/an: ________________

Mark for Review (1) Points

Supertype Intersection Table Intersection Entity (*) Subtype Correct 6. 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 7. The explanation below is a User Defined integrity rule and must, therefore, be manually coded; the Database cannot enforce this rule automatically. True or False? A primary key must be unique, and no part of the primary key can be null.

Mark for Review (1) Points

True False (*) Correct 8. A foreign key cannot refer to a primary key in the same table. True or False?

Mark for Review (1) Points

True False (*) Correct 9. A table must have a primary key. True or False?

Mark for Review (1) Points

True False (*) Correct 10. 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. (*) Correct Section 11 (Answer all questions in this section) 11. A table must have at least one candidate key, as well as its primary key. True or False?

Mark for Review (1) Points

True False (*) Correct

Section 12 (Answer all questions in this section) 12. System Documentation is developed right at the end once the system has gone live and users have been using it for a little while. You are more likely to get it correct that way. True or False?

Mark for Review (1) Points

True False (*) Correct. 13. During which phases of the System Development Life Cycle would you test the system before rolling it out to the users?

Mark for Review (1) Points

Build and Transition

Strategy and Analysis Design and Production Transition and Production (*) Correct. 14. The f_customers table contains the following data:

Mark for

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

Review (1) Points

If you run the following statement: DELETE FROM F_CUSTOMERS WHERE ID 20000;

Mark for Review (1) Points

Which values would cause the logical condition to return TRUE?

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

Mark for Review (1) Points

SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM employees; SELECT last_name||', '|| job_id "Employee and Title" FROM employees; (*) SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM emp;

SELECT last_name||","|| job_id "Employee and Title" FROM employees; Correct. 27. You need to display all the employees whose last names (of any length) start 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_' Correct. 28. 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. 29. The EMPLOYEES table contains these columns: LAST_NAME VARCHAR2(25) FIRST_NAME VARCHAR2(25) EMAIL VARCHAR2(50) You are writing a SELECT statement to retrieve the names of employees that have an email address. SELECT last_name||', '||first_name "Employee Name" FROM employees; Which WHERE clause should you use to complete this statement?

WHERE email = NULL; WHERE email != NULL; WHERE email IS NULL; WHERE email IS NOT NULL; (*) Correct.

Mark for Review (1) Points

30. 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. Section 16 (Answer all questions in this section) 31. Which comparison operator searches for a specified character pattern?

Mark for Review (1) Points

IN LIKE (*) BETWEEN...AND... IS NULL Correct. 32. You need to display employees with salaries that are at least 30000 or higher. Which comparison operator should you use?

Mark for Review (1) Points

> "=>" >= (*) != Correct. 33. 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 UNIQUEONE DISTINCT (*) DISTINCTROW Correct. 34. When using the LIKE condition to search for _ symbols, which character can you use as the default ESCAPE option?

Mark for

Review (1) Points % ^ & \ (*) Correct. 35. 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?

Mark for Review (1) Points

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 10000 AND 25000 (*) Correct. 36. When using the LIKE condition, which symbol represents any sequence of characters of any length--zero, one, or more characters?

Mark for Review (1) Points

_ % (*) # & Correct.

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

Reorder the clauses in the query. (*)

Mark for Review (1) Points

Remove the table aliases in the WHERE clause. Remove the table aliases in the ORDER BY clause. Include a HAVING clause. Correct. 38. 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:

Mark for Review (1) Points

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. (*) Incorrect! See Section 17 Lesson 3. 39. 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

Mark for Review (1) Points

AND team_id BETWEEN 1200 AND 1500 ORDER BY team_id, salary DESC; (*) SELECT last_name, first_name, team_id, salary FROM players WHERE salary > 24999.99 AND salary < 100000 AND team_id BETWEEN 1200 AND 1500 ORDER BY team_id ASC, salary DESC; SELECT last_name, first_name, team_id, salary FROM players WHERE salary BETWEEN 24999.99 AND 100000.01 AND team_id BETWEEN 1200 AND 1500 ORDER BY team_id DESC, salary DESC; Correct. 40. Which statement about the logical operators is true?

Mark for Review (1) Points

The order of operator precedence is AND, OR, and NOT. The order of operator precedence is AND, NOT, and OR. The order of operator precedence is NOT, OR, and AND. The order of operator precedence is NOT, AND, and OR. (*) Correct. Section 17 (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 Correct. 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. Which logical operator returns TRUE if either condition is true?

Mark for Review (1) Points

OR (*) AND NOT BOTH Correct. 44. Which of the following are TRUE regarding the logical AND operator?

Mark for Review (1) Points

TRUE AND TRUE return FALSE TRUE AND FALSE return TRUE FALSE AND TRUE return NULL TRUE AND FALSE return FALSE (*) Correct. 45. 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. 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.

Mark for Review (1) Points

The result will not be sorted. Correct. 47. Evaluate this SELECT statement: SELECT last_name, first_name, department_id, manager_id FROM employees;

Mark for Review (1) Points

You need to sort data by manager id values and then alphabetically by employee last name and first name values. Which ORDER BY clause could you use?

ORDER BY department_id, last_name ORDER BY manager_id, last_name, first_name (*) ORDER BY last_name, first_name, manager_id ORDER BY manager_id, first_name, last_name Correct. 48. Evaluate this SELECT statement: SELECT first_name, last_name, email FROM employees ORDER BY last_name;

Mark for Review (1) Points

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

Mark for Review (1) Points

Correct. 50. 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 14837 - Smith

Start Date and Salary 10-MAY-1992 / 5000

Which SELECT statement could you use?

SELECT employee_id || - || last_name "Employee", hire_date || / || salary "Start Date and Salary FROM employees WHERE hire_date