Question: Following question uses MySQL. Uses AP database. Creating after triggers are my main problem for this question. 1. The following trigger automatically generates a shipping
Following question uses MySQL. Uses AP database. Creating after triggers are my main problem for this question.
1. The following trigger automatically generates a shipping label as soon as the PaymentTotal column of the Invoice total is updated. Such a trigger may be useful for mailing updated/paid Invoices to customers.

Create the ShippingLabel table first in your AP database. Then write an AFTER trigger to insert data in the ShippingLabel table with data from the Vendors table. In order to get the VendorID that is being updated, you need to select the VendorID from the virtual Inserted table.
The updated row of data is stored in a virtual table called Inserted. Fill the table below.
| Invoice ID | Vendor ID | Invoice Number | Invoice Date | Invoice Total | Payment Total | Credit Total | Terms ID | Invoice Due Date | Payment Date |
|
|
|
|
|
|
|
|
|
|
|
Create a trigger for the Invoices table that automatically inserts the vendor name and address for a paid invoice into a table named Shipping Labels. The trigger should fire any time the Payment Total column of the Invoices table is updated. The structure of the ShippingLabels table is as follows: CREATE TABLE ShippingLabels varchar (50) (VendorName vendor Address1 varchar (50), vendor Address2 varchar (50), Vendor City varchar (50) vendor State char (2), vendor ZipCode varchar (20) Use this UPDATE statement to test the trigger: UPDATE Invoices SET Payment Total 67.92 PaymentDate 2012-04-23 WHERE InvoiceID 100
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
