1Z0-007 · Question #147
Examine the data in the EMPLOYEES and DEPARTMENTS tables: Also examine the SQL statements that create the EMPLOYEES and DEPARTMENTS tables: CREATE TABLE departments (department_id NUMBER PRIMARY…
The correct answer is B. The statement fails because there are child records in the EMPLOYEES table with department ID 40. It will be error generated because there are 2 child records in the EMPLOYEES table with department number you try to delete from the DEPARTMENTS table. Incorrect Answers A: The row with department ID 40 will not be deleted because of the child records in the EMPLOYEES table…
Question
Examine the data in the EMPLOYEES and DEPARTMENTS tables:
Also examine the SQL statements that create the EMPLOYEES and DEPARTMENTS tables:
CREATE TABLE departments (department_id NUMBER PRIMARY KEY, department_name VARCHAR2(30)); CREATE TABLE employees (EMPLOYEE_ID NUMBER PRIMARY KEY, EMP_NAME VARCHAR2(20), DEPT_ID NUMBER REFERENCES departments(department_id), MGR_ID NUMBER REFERENCES employees(employee id), MGR_ID NUMBER REFERENCES employees(employee id), JOB_ID VARCHAR2(15). SALARY NUMBER); ON the EMPLOYEES, On the EMPLOYEES table, EMPLOYEE_ID is the primary key. MGR_ID is the ID of managers and refers to the EMPLOYEE_ID. DEPT_ID is foreign key to DEPARTMENT_ID column of the DEPARTMENTS table. On the DEPARTMENTS table, DEPARTMENT_ID is the primary key. Examine this DELETE statement:
DELETE FROM departments WHERE department id = 40; What happens when you execute the DELETE statement?
Exhibit
Options
- AOnly the row with department ID 40 is deleted in the DEPARTMENTS table.
- BThe statement fails because there are child records in the EMPLOYEES table with department ID 40.
- CThe row with department ID 40 is deleted in the DEPARTMENTS table.
- DThe row with department ID 40 is deleted in the DEPARTMENTS table.
- EThe row with department ID 40 is deleted in the DEPARTMENTS table.
- FThe statement fails because there are no columns specifies in the DELETE clause of the DELETE
How the community answered
(28 responses)- A4% (1)
- B71% (20)
- C4% (1)
- D7% (2)
- F14% (4)
Explanation
It will be error generated because there are 2 child records in the EMPLOYEES table with department number you try to delete from the DEPARTMENTS table. Incorrect Answers A: The row with department ID 40 will not be deleted because of the child records in the EMPLOYEES table. C: Neither the row with department ID 40 will not be deleted not child records in the EMPLOYEES table will be deleted. D: It will be error when you try to execute the DELETE statement, no rows will be deleted in the EMPLOYEES or the DEPARTMENTS tables. E: It will be error when you try to execute the DELETE statement, no rows will be deleted in the EMPLOYEES or the DEPARTMENTS tables. F: The statement fails because of constraint violation not because there are no columns specifies in the DELETE clause of the DELETE statement.
Topics
Community Discussion
No community discussion yet for this question.
