Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions