Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (7 pts) Use Oracle SQL to create a script file that declares table schema based on the following assumptions, and then inserts data records

image text in transcribed

1. (7 pts) Use Oracle SQL to create a script file that declares table schema based on the following assumptions, and then inserts data records into the tables (a) Different departments have different names. (b) A department may temporarily have no manager (c) Different employees may have the same name (d) An employee can work as a manager for at most one department (e) People who work in the HR department should earn at least 20,000 dollars. (f) When deleting a record of an employee who is a manager, the managerID field of the department she/he works for should be set to null. (g) When deleting a record of a department, the deptName field of all employees who work in that department should be set to null. All constraints must be declared before any actual data is inserted into tables Departments Name HR RD SALES manager Name ohn Robert enny Christ Bill Susan Salary 56000 37500 46000 39000 50000 67500 deptName RD HR HR SALES RD RD ID 123 578 101 2. (1 pt) Insert the following record into table Employees, what would happen? Name Mike Salary 18000 deptName HR ID 3. (1 pt) Delete the SALES department from table Departments, what would happen? 4. (1 pt) Delete the employee whose ID is 666 from table Employees, what would happen? 1. (7 pts) Use Oracle SQL to create a script file that declares table schema based on the following assumptions, and then inserts data records into the tables (a) Different departments have different names. (b) A department may temporarily have no manager (c) Different employees may have the same name (d) An employee can work as a manager for at most one department (e) People who work in the HR department should earn at least 20,000 dollars. (f) When deleting a record of an employee who is a manager, the managerID field of the department she/he works for should be set to null. (g) When deleting a record of a department, the deptName field of all employees who work in that department should be set to null. All constraints must be declared before any actual data is inserted into tables Departments Name HR RD SALES manager Name ohn Robert enny Christ Bill Susan Salary 56000 37500 46000 39000 50000 67500 deptName RD HR HR SALES RD RD ID 123 578 101 2. (1 pt) Insert the following record into table Employees, what would happen? Name Mike Salary 18000 deptName HR ID 3. (1 pt) Delete the SALES department from table Departments, what would happen? 4. (1 pt) Delete the employee whose ID is 666 from table Employees, what would happen

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions