Question: Write a sequence of SQL Statements that include two Stored Triggers, SQL Statements to Create an Audit Trail Table that tracks Updating and Deleting Rows

Write a sequence of SQL Statements that include two Stored Triggers, SQL Statements to Create an Audit Trail Table that tracks Updating and Deleting Rows in Tables in your version for the CCP Vehicle Loan System Database, DELETE and UPDATE Statements to invoke and test the Stored Triggers.

  • Write a Stored Trigger linked updating a table row for the CCP Vehicle Loan System Database
  • Write a Stored Trigger linked deleting a table row for the CCP Vehicle Loan System Database

For each Trigger, a copy of the row before the update or delete operation should be placed in one or more audit tables that keep track of the history of the data.

Your Script must contain SQL Statements that Test and Verify that the Triggers are working correctly. This means it must include the following

  • A Delete Statement removing one or more rows from a table
  • An Update Statement changing one or more rows from a table
  • CREATE TABLE Statement to create your version of the audit table storing the versions of the data before being deleted or updated
  • SELECT Statements visually confirming the success of the operations. This is a SELECT Statement listing the contents of the audit table or tables being used to track the original version of the instances before the modification or deletion.

Students must create an UPDATE Trigger and a DELETE Trigger. Students must also demonstrate that the triggers are working. This was described, illustrated, and accomplished in the Guide Practice Video on CREATING Stored Triggers. In that video, it demonstrated using an Audit Table or Tables that captured data from the table before it was updated or deleted. The SQL script must include at least 1 DELETE Statement that deletes at least 1 instance from the Table linked to the DELETE Statement. The SQL script must include at least 1 UPDATE Statement that updates at least 1 instance in the table linked to the Update Trigger.

The update can occur across 1 or more attributes within a row and 1 or more rows within a table. The scope of each update statement is entirely up to you.

Students can use their creativity based on what they studied to choose the SQL Statements in the body of the Stored Trigger.

I am looking for the following

  1. Script to Create the Database and Create the Required Tables being used from the Homework Database.
  2. Script to insert necessary Test Data
  3. Two Functional Syntax Error Free Stored Triggers
  4. A DELETE Statement to Invoke the DELETE Stored Trigger
  5. An UPDATE Statement to Invoke the UPDATE Stored Trigger
  6. One or more SELECT Statements to verify the Execution of the Stored Triggers
  7. All the Script is contained in a single SQL Text File
  8. The Script runs continuously without any Syntax Errors

The Script

Submit the following code in the SQL script file you are submitting

  • Your version of the SQL script to create the Art Exhibition Database and Insert Test Data. This version must use INSERT INTO Statements to place data into the database

  • SQL Script containing the Stored Triggers for the Art Exhibition Database
  • The Statement to activate and perform the Stored Trigger
  • Statements to visually verify that the Trigger was executed.

The File must have a SQL Extension to receive points for the submission

You can combine the CREATE TABLE Statements, INSERT INTO Statements, and SQL Script supporting the Triggers into one SQL File

If you are using comments in the script files or files, you must use them correctly. The script must run continuously. Any commands that do not operate correctly due to improperly formatted comments will not be assessed in the final point accumulation for the assignment.

Submit an SQL Text File for the SQL portion of this assignment. An SQL Text File is a text file with a ".SQL" extension on the file name.

  • The script should be well documented with comments
  • All the scripts should be placed in one file
  • The script should run continuously without errors

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!