Question: TRIGGERS Trigger 1 - Build a trigger on the emp table after insert that adds a record into the emp_History table and marks IsActive column

  1. TRIGGERS
    1. Trigger 1 - Build a trigger on the emp table after insert that adds a record into the emp_History table and marks IsActive column to 1

  1. Trigger 2 - Build a tirgger on the emp table after an update of the empname or deptid column - It updates the subsequent empname and/or deptid in the emp_history table.

  1. Build a trigger on the emp table after delete that marks the isactive status = 0 in the emp_History table.

  1. Run this script - Results should show 10 records in the emp history table all with an active status of 0

INSERT INTO dbo.emp_triggers

SELECT 'Ali',1000

INSERT INTO dbo.emp_triggers

SELECT 'Buba',1000

INSERT INTO dbo.emp_triggers

SELECT 'Cat',1001

INSERT INTO dbo.emp_triggers

SELECT 'Doggy',1001

INSERT INTO dbo.emp_triggers

SELECT 'Elephant',1002

INSERT INTO dbo.emp_triggers

SELECT 'Fish',1002

INSERT INTO dbo.emp_triggers

SELECT 'George',1003

INSERT INTO dbo.emp_triggers

SELECT 'Mike',1003

INSERT INTO dbo.emp_triggers

SELECT 'Anand',1004

INSERT INTO dbo.emp_triggers

SELECT 'Kishan',1004

DELETE FROM dbo.emp_triggers

  1. Create 5 views - Each view will use 3 tables and have 9 columns with 3 coming from each table.
    1. Create a view using 3 Human Resources Tables (Utilize the WHERE clause)
    2. Create a view using 3 Person Tables (Utilize 3 system functions)
    3. Create a view using 3 Production Tables (Utilize the Group By Statement)
    4. Create a view using 3 Purchasing Tables (Utilize the HAVING clause)
    5. Create a view using 3 Sales Tables (Utilize the CASE Statement)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related General Management Questions!