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.
In adventureworks or any database in SQL
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
