Question
Create table Employee: empID (PK), empFname, empLname, deptID(FK) Insert least six rows in the Employee table. Assumption: Employee ID once in the EMPLOYEE table can't
Create table Employee: empID (PK), empFname, empLname, deptID(FK)
Insert least six rows in the Employee table.
Assumption:
Employee ID once in the EMPLOYEE table can't be changed.
Modify tables to enforce these rules.
Check what happens with department chair when you delete employee from the Employee table. Do you see a problem?
Write a trigger to fix this problem. You have to raise application error when someone tries to delete employee who is listed as a department chair in the department table. It can be achieved several different ways, but for this exercise, you will use a trigger.
Create at least four test cases to test the solution.
Steps:
1. Write SQL code to create table.
2. Write SQL code to insert values in table
3. Write Trigger code
4. Create Test cases and check trigger execution results.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started