Test: Final Exam Semester 2 - Part I

Review your answers, feedback, and question scores below. An asterisk (*) indica tes a correct answer. Section 10 (Answer all questions in this section) 1. Which statement about the NOT NULL constraint is true? Mark for Review (1) Points The NOT NULL constraint must be defined at the column level. (*) The NOT NULL constraint can be defined at either the column level or the tab le level. The NOT NULL constraint requires a column to contain alphanumeric values. The NOT NULL constraint prevents a column from containing alphanumeric value s. Incorrect. Refer to Section 10 Lesson 1. 2. Which two statements about NOT NULL constraints are true? (Choose two) Ma rk for Review (1) Points (Choose all correct answers) The Oracle Server creates a name for an unnamed NOT NULL constraint. (*) A NOT NULL constraint can be defined at either the table or column level. The NOT NULL constraint requires that every value in a column be unique. Columns with a NOT NULL constraint can contain null values by default. You CANNOT add a NOT NULL constraint to an existing column using the ALTER T ABLE ADD CONSTRAINT statement. (*) Incorrect. Refer to Section 10 Lesson 1. 3. You need to add a NOT NULL constraint to the COST column in the PART table . Which statement should you use to complete this task? Mark for Review (1) Points ALTER TABLE part MODIFY (cost part_cost_nn NOT NULL); ALTER TABLE part MODIFY (cost CONSTRAINT part_cost_nn NOT NULL); (*)

6. Foreign Key. Primary Key. Unique Key and Check Constraints can be added at which two levels? (Choose two) Mark for Review (1) Points (Choose all correct answers) Null Field Table (*) Row Dictionary Column (*) Incorrect. Refer to Section 10 Lesson 1. Which type of constraint should you define on the LAST_NAME column? Mark for R eview (1) Points CHECK UNIQUE NOT NULL (*) PRIMARY KEY Correct 5. . Incorrect. True or False? M ark for Review (1) Points True False (*) Incorrect. A table can only have one unique key constraint defined. You need to ensure that the LAST_NAME column does not contain null values. 4. ALTER TABLE part ADD (cost CONSTRAINT part_cost_nn NOT NULL). Refer to Section 10 Lesson 1.ALTER TABLE part MODIFY COLUMN (cost part_cost_nn NOT NULL). Refer to Section 10 Lesson 1.

(*) Add a FOREIGN KEY constraint to the EMPLOYEES table restricting manager ID t o match every employee ID. The constraint is referenced by the na me FK_DEPT_ID_01. You need to ensure that each value in the SEAT_ID column is unique or null . 9. Incorrect. Refer to Section 10 Lesson 3. You want to disable the FOREIGN KEY constraint that is defined in the EMP LOYEES table on the DEPARTMENT_ID column. Refer to Section 10 Lesson 1. Add a FOREIGN KEY constraint to the EMPLOYEES table indicating that a manage r must already be an employee. Which constraint should you define on the SEAT_ID column? Mark for Review (1) Points CHECK UNIQUE (*) NOT NULL PRIMARY KEY Incorrect. 10. Which statement should you issue? Mark for Review (1) Points . Refer to Section 10 Lesson 3. This SQL command will do what? ALTER TABLE employees ADD CONSTRAINT emp_manager_fk FOREIGN KEY(manager_id) REFERENCES employees(emplo yee_id).7. Which data dictionary view should you query? Mark for Review (1) Points DBA_CONSTRAINTS USER_CONSTRAINTS (*) ALL_CONS_COLUMNS USER_CONS_COLUMNS Incorrect. You need to display the names and definitions of constraints only in your schema. 8. Mark for Review (1) Points Alter the table employees and disable the emp_manager_fk constraint. Alter table employees and add a FOREIGN KEY constraint that indicates each e mployee ID must be unique.

Which clause should you use? Mark for Review . ALTER TABLE employees DISABLE CONSTRAINT 'fk_dept_id_01'. and question scores below.Part I Review your answers. Section 10 (Answer all questions in this section) 11. (*) Incorrect. (*) Using the UPDATE command on rows based in another table.ALTER TABLE employees DISABLE 'fk_dept_id_01'. Which of the following would definitely cause an integrity constraint err or? Mark for Review (1) Points Using a subquery in an INSERT statement. Refer to Section 10 Lesson 3. Using the DELETE command on a row that contains a primary key with a depende nt foreign key declared without either an ON DELETE CASCADE or ON DELETE SET NUL L. You need to add a NOT NULL constraint to the EMAIL column in the EMPLOYEE S table. feedback. Correct 12. ALTER TABLE employees DISABLE CONSTRAINT fk_dept_id_01. An asterisk (*) indica tes a correct answer. ALTER TABLE employees DISABLE fk_dept_id_01. Using the MERGE statement to conditionally insert or update rows. Page 1 of 5 Test: Final Exam Semester 2 .

Which statement should you use? Mark for Review (1) Points .(1) Points ADD CHANGE MODIFY (*) DISABLE Correct 13. Incorrect. Evaluate this statement: ALTER TABLE employees ADD CONSTRAINT employee_id PRIMARY KEY. The LINE_ITEM table contains these columns: LINE_ITEM_ID NUMBER PRIMARY KEY PRODUCT_ID NUMBER(9) FOREIGN KEY references the ID column of the PRODUCT table QUANTITY NUMBER(9) UNIT_PRICE NUMBER(5. 14. Which result will the statement provide? Mark for Review (1) Points A syntax error will be returned. Refer to Section 10 Lesson 3. Refer to Section 10 Lesson 3. 15. An existing constraint on the EMPLOYEES table will be overwritten. (*) A constraint will be added to the EMPLOYEES table. You can view the columns used in a constraint defined for a specific tabl e by looking at which data dictionary table? Mark for Review (1) Points USER_CONS_COLUMNS (*) CONSTRAINTS_ALL_COLUMNS SYS_DATA_DICT_COLUMNS US_CON_SYS Incorrect. An existing constraint on the EMPLOYEES table will be enabled.2) You need to disable the FOREIGN KEY constraint.

Drop. Enable. Disable. PRIMARY KEY SUPPLIER_NAME VARCHAR2 (25) ADDRESS VARCHAR2 (30) CITY VARCHAR2 (25) REGION VARCHAR2 (10) POSTAL_CODE VARCHAR2 (11) Evaluate this statement: ALTER TABLE suppliers DISABLE CONSTRAINT supplier_id_pk CASCADE.2) COST NUMBER (7. Refer to Section 10 Lesson 3. Disregard Incorrect. Examine the structures of the PRODUCT and SUPPLIER tables. (*) ALTER TABLE line_item DROP CONSTRAINT product_id_fk. Subtract. Enable. Refer to Section 10 Lesson 3. Enable. Disable. Incorrect.ALTER TABLE line_item DISABLE CONSTRAINT product_id_fk. 16. What actions can be performed on or with Constraints? Mark for Review (1) Points Add. ALTER TABLE line_item ENABLE CONSTRAINT product_id_fk. Drop. Cascade Add. . 17. Cascade (*) Add. ALTER TABLE line_item DELETE CONSTRAINT product_id_fk. Minus. Collapse Add. PRODUCT PRODUCT_ID NUMBER NOT NULL.2) QTY_IN_STOCK NUMBER QTY_ON_ORDER NUMBER REORDER_LEVEL NUMBER REORDER_QTY NUMBER SUPPLIER SUPPLIER_ID NUMBER NOT NULL. Disable. PRIMARY KEY PRODUCT_NAME VARCHAR2 (25) SUPPLIER_ID NUMBER FOREIGH KEY to SUPPLIER_ID of the SUPPLIER table LIST_PRICE NUMBER (7.

What must exist on the Parent table before Oracle will allow you to creat e a FOREIGN KEY constraint from a Child table? Mark for Review (1) Points A FOREIGN KEY constraint allows the constrained column to contain values tha t exist in the primary key column of the parent table. A PRIMARY or UNIQUE KEY constraint must exist on the Parent table. A foreign key value must either be null or match an existing value in the pa rent table. 19. Refer to Section 10 Lesson 3. Refer to Section 10 Lesson 2. 18. A foreign key value must be unique.For which task would you issue this statement? Mark for Review (1) Points To remove all constraint references to SUPPLIERS table To drop the FOREIGN KEY constraint on the PRODUCTS table To remove all constraint references to the PRODUCTS table To disable any dependent integrity constraints on the SUPPLIER_ID column in the PRODUCTS table To disable any dependent integrity constraints on the SUPPLIER_ID column in the SUPPLIERS table (*) Incorrect. A foreign key value must match an existing value in the parent table. (*) An index must exist on the Parent table A CHECK constraint must exist on the Parent table. Which type of constraint by default requires that a column be both unique and not null? Mark for Review (1) Points FOREIGN KEY . 20. Incorrect. Refer to Section 10 Lesson 2. Which statement about a non-mandatory foreign key constraint is true? Ma rk for Review (1) Points A foreign key value cannot be null. (*) Incorrect.

A FOREIGN KEY constraint requires the constrained column to contain values t hat exist in the referenced Primary or Unique key column of the parent table. feedback. Section 10 (Answer all questions in this section) 21. 22. A FOREIGN KEY column can have a different data type from the primary key col umn that it references. and question scores below. Incorrect. Which statement about a FOREIGN KEY constraint is true? Mark for Review (1) Points An index is automatically created for a FOREIGN KEY constraint. Refer to Section 10 Lesson 2.Part I Review your answers. An asterisk (*) indica tes a correct answer. (* ) A FOREIGN KEY constraint allows that a list of allowed values be checked bef ore a value can be added to the constrained column. . Which constraint type enforces uniqueness? Mark for Review (1) Points CHECK FOREIGN KEY PRIMARY KEY (*) NOT NULL Incorrect.PRIMARY KEY (*) UNIQUE CHECK Correct Page 2 of 5 Test: Final Exam Semester 2 . Refer to Section 10 Lesson 2.

24.23. You need to create the PROJECT_HIST table. The table must meet these requ irements: The table must contain the EMPLOYEE_ID and TASKED_HOURS columns for numeric data . Which statement is true? Mark for Review (1) Points The PRIMARY KEY constraint must be defined at the table level. The table must contain the HOURLY_RATE and PROJECT_COST columns for numeric data with precision and scale of 5. You need to create a composite primary key constraint on the EMPLOYEES ta ble. How many PRIMARY KEY constraints can be created for each table? Mark for Review (1) Points None One and only one (*) One or two Unlimited Correct 26. 25. The table must have a composite primary key on the EMPLOYEE_ID and START_DATE co . which keyword(s) identifies the t able and column in the parent table? Mark for Review (1) Points FOREIGN KEY REFERENCES (*) ON DELETE CASCADE ON DELETE SET NULL Incorrect. When creating a referential constraint. The PRIMARY KEY constraint must be defined at the table level and for each c olumn in the composite primary key. Incorrect.2 and 10. Refer to Section 10 Lesson 2.2 respectively. The table must contain the START_DATE and END_DATE column for date values. Refer to Section 10 Lesson 2. (*) A PRIMARY KEY constraint must be defined for each column in the composite pr imary key. The PRIMARY KEY constraint must be defined for the first column of the compo site primary key.

lumns. project_cost NUMBER(10. Refer to Section 8 Lesson 3. tasked_hours NUMBER. You need to remove all the rows from the SALES_HIST table.2). but do not want to remove the table structure. 28.2) Which statement should you use to decrease the width of the FIRST_NAME column to 10 if the column currently contains 1500 records. Which st atement should you use? Mark for Review (1) Points The DROP TABLE statement The ALTER TABLE statement The DELETE statement The TRUNCATE TABLE statement (*) Incorrect. start_date)). Evaluate this CREATE TABLE statement: CREATE TABLE project_hist ( employee_id NUMBER. start_date DATE. hourly_rate NUMBER(5. The PLAYERS table contains these columns: PLAYER_ID NUMBER(9) PRIMARY KEY LAST_NAME VARCHAR2(20) FIRST_NAME VARCHAR2(20) TEAM_ID NUMBER(4) SALARY NUMBER(9. How many of the requirements does the CREATE TABLE statement satisfy? Mark for Review (1) Points None of the four requirements All four of the requirements (*) Only three of the requirements Only two of the requirements Correct Section 8 (Answer all questions in this section) 27. but none are longer than 10 b ytes or characters? . CONSTRAINT project_hist_pk PRIMARY KEY(employee_id. end_date DATE.2). You want to re lease the storage space.

Using the ALTER TABLE CREATE COMMENT syntax Using the COMMENT ON TABLE or COMMENT on COLUMN (*) Using an UPDATE statement on the USER_COMMENTS table Correct 30. 29.2) The EMPLOYEE_ID column currently contains 500 employee identification numbers. Evaluate the structure of the EMPLOYEE table: EMPLOYEE_ID NUMBER(9) LAST_NAME VARCHAR2(25) FIRST_NAME VARCHAR2(25) DEPARTMENT_ID NUMBER(9) MANAGER_ID NUMBER(9) SALARY NUMBER(7. (*) Incorrect. Which statement should you use to change this column's data type? Mark for Review (1) Points ALTER TABLE employee MODIFY (employee_id VARCHAR2(9)). Refer to Section 8 Lesson 3. Comments on tables and columns can be stored for documentation by: Mark for Review (1) Points Embedding /* comment */ within the definition of the table. ALTER TABLE players RENAME first_name VARCHAR2(10). ALTER TABLE players MODIFY (first_name VARCHAR2(10)). .Mark for Review (1) Points ALTER players TABLE MODIFY COLUMN first_name VARCHAR2(10). ALTER players TABLE MODIFY COLUMN (first_name VARCHAR2(10)). ALTER TABLE employee REPLACE (employee_id VARCHAR2(9)). B usiness requirements have changed and you need to allow users to include text ch aracters in the identification values.

Refer to Section 8 Lesson 3. and question scores below.2) (*) Incorrect. 32.ALTER employee TABLE MODIFY COLUMN (employee_id VARCHAR2(15)).2) Changes the definition of the BACKORDER_AMOUNT column to NUMBER(8.Part I Review your answers. Which statement should you use? Mark for Review (1) Points DROP TABLE (*) TRUNCATE TABLE ALTER TABLE . as the table is n ot empty. You need to remove all the data in the SCHEDULE table. Refer to Section 8 Lesson 3. the structure of t he table. You CANNOT modify the data type of the EMPLOYEE_ID column. feedback. An asterisk (*) indica tes a correct answer. Section 8 (Answer all questions in this section) 31. Which task will this statement accomplish? Mark for Review (1) Points Alters the definition of the BACKORDER_AMOUNT column to NUMBER(8 2) Alters the definition of the BACKORDER_AMOUNT column to NUMBER Alters the definition of the BACKORDER_AMOUNT column to NUMBER(2. Evaluate this statement: ALTER TABLE inventory MODIFY backorder_amount NUMBER(8. and the indexes associated with the table.2).8) Alters the definition of the BACKORDER_AMOUNT column to NUMBER(8. (*) Incorrect. Page 3 of 5 Test: Final Exam Semester 2 .

(*) You can convert a CHAR data type column to the VARCHAR2 data type. which contains outdated data. Incorrect. You can convert a DATE date type column to a VARCHAR2 column. You want to remove the table and its data from the database. Which statement about a column is NOT true? Mark for Review (1) Points You can increase the width of a CHAR column. Whi ch statement should you issue? Mark for Review (1) Points DROP TABLE (*) DELETE TRUNCATE TABLE ALTER TABLE Incorrect. Evaluate this statement: TRUNCATE TABLE employees. Which statement about this TRUNCATE TABLE statement is true? Mark for Review (1) Points You can produce the same results by issuing the 'DROP TABLE employee' statem ent. You can modify the data type of a column if the column contains non-null dat a. 34. 35. Refer to Section 8 Lesson 3. Refer to Section 8 Lesson 3. Correct . You can issue this statement to retain the structure of the employees table.DELETE TABLE Incorrect. 33. (*) You can reverse this statement by issuing the ROLLBACK statement. Refer to Section 8 Lesson 3. The previous administrator created a table named CONTACTS. You can produce the same results by issuing the 'DELETE employees' statement .

The EMPLOYEES table is not in y our schema. name and date of birth? Mark for Review (1) Points CREATE table BIRTHDAYS (EMPNO. 37. Refer to Section 8 Lesson 3. Refer to Section 8 Lesson 3. Empname CHAR(20). Which privilege must you have to truncate the table? Mark for Revie w (1) Points The DROP ANY TABLE system privilege (*) The TRUNCATE ANY TABLE system privilege The CREATE ANY TABLE system privilege The ALTER ANY TABLE system privilege Incorrect. Birthdate DATE). (*) CREATE TABLE Birthdays (Empno NUMBER. 38. date of birth).36. Both changes can be accomplished with one ALTER TABLE statement. The DONATIONS table currently contains NO records.2) PAYMENT_DT DATE You need to reduce the precision of the AMOUNT_PLEDGED column to 5 with a scale of 2 and ensure that when inserting a row into the DONATIONS table without a val ue for the AMOUNT_PLEDGED column. You must use the ADD OR REPLACE option to achieve these results. Incorrect. name. Examine the structure of the DONATIONS table. BIRTHDATE). Which statement is true? Mark for Review (1) Points You CANNOT decrease the width of the AMOUNT_PLEDGED column. EMPNAME.2) AMOUNT_PAID NUMBER (7. Empname CHAR(20).00 will automatically be insert ed. You need to truncate the EMPLOYEES table. CREATE table BIRTHDAYS (employee number. Which of the following SQL statements will create a table called Birthday s with three columns for storing employee number. (*) You must drop and recreate the DONATIONS table to achieve these results. DONATIONS: PLEDGE_ID NUMBER DONOR_ID NUMBER PLEDGE_DT DATE AMOUNT_PLEDGED NUMBER (7. . Date of Birth DATE). CREATE TABLE Birthdays (Empno NUMBER. a price of $10.

SALARY. FIRST_NAME. salary. last_name.Part I . Correct 40. salary. first_name. You created the LINE_ITEM table in the SYS schema. last_name. first_name. CREATE TABLE emp AS SELECT employee_id. You are a member of the SYSDBA role. order_id NUMBER(9). salary. CREATE TABLE emp (employee_id. department_id FROM employees. Evaluate this CREATE TABLE statement: CREATE TABLE line_item ( line_item_id NUMBER(9). but are not logged in as SYSDBA. You issue this CREATE TABLE statement. last_name.Incorrect. Refer to Section 8 Lesson 1. last_name. (*) Incorrect. and DEPARTMENT_ID columns. (*) You created the table in the SYSDBA schema. Page 4 of 5 Test: Final Exam Semester 2 . department_id FROM employees. product_id NUMBER(9)). Which statement is true? Mark for Review (1) Points You created the LINE_ITEM table in the public schema. You created the table in your schema. Mark for Review (1) Points CREATE TABLE employee AS SELECT employee_id. first_name. LA ST_NAME. department_id FROM employees ). salary. first_name. CREATE TABLE emp SELECT (employee_id. Refer to Section 8 Lesson 1. department_id) . 39. Which SQL statement below will correctly create the EMP table based on th e structure of the EMPLOYEES table? Include only the EMPLOYEE_ID.

44. Incorrect. CREATE TABLE time_date (time NUMBER(9)). Which data type s hould you specify for this column? Mark for Review . 42. You are designing a table for the Human Resources department. Refer to Section 8 Lesson 1. (*) CREATE TABLE time (time_id NUMBER(9)). Which CREATE TABLE statement will fail? Mark for Review (1) Points CREATE TABLE date_1 (date_1 DATE).10) commission_pct NUMBER(4.Review your answers. Refer to Section 8 Lesson 1. 43. Section 8 (Answer all questions in this section) 41. and question scores below. You want to create a database table that will contain information regardi ng products that your company released during 2001. feedback. Which line should you include in the CREATE TABLE s tatement to accomplish this task? Mark for Review (1) Points commission_pct NUMBER(4. Which name can you assign to the table that you create? Mark for Review (1) Points 2001_PRODUCTS PRODUCTS_2001 (*) PRODUCTS_(2001) PRODUCTS--2001 Incorrect. This table should contain the COMMI SSION_PCT column and use a value of 10 percent if no commission value is provide d when a record is inserted. Refer to Section 8 Lesson 1.10 (*) commission_pct NUMBER(4. 0.2) DEFAULT = 0. An asterisk (*) indica tes a correct answer.10 commission_pct NUMBER(4.2) DEFAULT 0. This table must include a column that contains each employee's hire date. CREATE TABLE date (date_id NUMBER(9)).2) DEFAULT (0. You are creating the EMPLOYEES table.2) (DEFAULT.10) Incorrect.

(1) Points CHAR DATE (*) TIMESTAMP INTERVAL YEAR TO MONTH Incorrect. To store time with fractions of seconds. The SPEED_TIME column should store a fractional second value. 47. Refer to Section 8 Lesson 2. You need to store the SEASONAL data in months and years. Refer to Section 8 Lesson 2. Which data type should you use? Mark for Review (1) Points DATE DATETIME TIMESTAMP (*) INTERVAL DAY TO SECOND Incorrect. which datatype should be used fo r a table column? Mark for Review (1) Points DATE INTERVAL YEAR TO MONTH TIMESTAMP (*) INTERVAL DAY TO SECOND Correct . Which data type should you use? Mark for Review (1) Points DATE TIMESTAMP INTERVAL YEAR TO MONTH (*) INTERVAL DAY TO SECOND Correct 46. 45.

employee_id NUMBER(9). Refer to Section 8 Lesson 2. sale_date TIMESTAMP WITH LOCAL TIME ZONE DEFAULT SYSDATE.48. 49. Today's date should be used if no value is provided for the sale date. minutes and seconds. Description values can range from 0 to 30 characters so the column should be fixed in length. (*) Incorrect. or a comb ination of both. All employee identification values are only 6 digits so the column should be variable in length. customer_id NUMBER(9). Time to be stored as a date with fractional seconds. Evaluate this CREATE TABLE statement: CREATE TABLE sales ( sales_id NUMBER(9). Which business requirement will this statement accomplish? Mark for Review (1) Points Sales identification values could be either numbers or characters. . sale_amount NUMBER(7. None of the above. Which data type should you specify for t his column? Mark for Review (1) Points CHAR DATE NUMBER (*) VARCHAR2 Incorrect. You are designing a table for the Sales department. The TIMESTAMP data type allows what? Mark for Review (1) Points Time to be stored as an interval of years and months. Refer to Section 8 Lesson 2. 50.2)). (*) Time to be stored as an interval of days to hours. Refer to Section 8 Lesson 2. Incorrect. You need to include a column that contains each sales total. description VARCHAR2(30).

Page 5 of 5 .

Master your semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master your semester with Scribd & The New York Times

Cancel anytime.