Question
You will create the following 4 triggers: - trgEmployee: Will be placed on the Employee table and listens for Inserts, Deletes, and Updates - trgJob:
You will create the following 4 triggers:
- trgEmployee: Will be placed on the Employee table and listens for Inserts, Deletes, and Updates
- trgJob: Will be placed on the Job table and listens for Inserts, Deletes, and Updates -
trgProject: Will be placed on the Project table that contains the projectId and projectName.
- trgActivity: Will be placed on the Activity table that contains the activityId and activityName.
Again, each trigger will write to its respective audit table:
trgProject will write to ProjectAudit
trgActivity will write to ActivityAudit
trgEmployee will write to EmployeeAudit
trgJob will write to JobAudit
Again, the columns which will be written to the audit tables will be all the original columns plus Operation and DateTimeStamp
MY CODE SO FAR:
create table EmployeeAudit ( empNumber char(8) PRIMARY KEY, firstName varchar(25), lastName varchar(25), ssn char(9), address varchar(50), state char(2), CONSTRAINT EMP_STATECHECK CHECK (state IN('CA', 'FL')), zip char(5), jobCode char(4) CONSTRAINT FK_JOB FOREIGN KEY (jobCode) REFERENCES Job(jobCode), dateOfBirth date, certification bit, salary money, Operation (varchar(50)), DateTimeStamp (datetime) );go
create table JobAudit ( jobCode(char(4) PRIMARY KEY, CONSTRAINT JOB_JOBCODE CHECK(jobCode IN( 'CAST', 'ENGI', 'INSP', 'PMGR')), jobdesc(varchar(50)), Operation (varchar(50)), DateTimeStamp (datetime) );go
create table ProjectAudit ( projectId char(4), primary key(projectId), projectName varchar(50), firmFedID char(9), fundedbudget decimal(16,2), projectStartDate date, projectstatus varchar(25), projectTypeCode char(5), projectedEndDate date, projectManager char(8), activityID char(4), Operation (varchar(50)), DateTimeStamp (datetime) );go
create table ActivityAudit ( activityId char(4), projectId char(4), activityName varchar(50), costToDate decimal(16,2), activityStatus varchar(25), startDate date, endDate date primary key(projectId,activityId), Operation (varchar(50)), DateTimeStamp (datetime) );go
create trigger trgEmployee ();go
create trigger trgJob ();go
create trigger trgProject ();go
create trigger trgActivity ();go
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started