Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create table Department Department: deptID(PK), deptName, chairID Insert 4 values into Department table Each department has exactly one chair Check what happens with department chair

Create table Department Department: deptID(PK), deptName, chairID

Insert 4 values into Department table

Each department has exactly one chair

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.

Create at least four test cases to test the solution.

Please use Adventure works database or create a new database

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago