Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Recommended Textbook for

Business Writing For Hospitality

Authors: Peter Nyhiem, Vivienne J Wildes

1st Edition

0131715712, 9780131715714

More Books

Students also viewed these General Management questions

Question

1. What do I want to achieve?

Answered: 1 week ago

Question

3. What is my goal?

Answered: 1 week ago