Question: Please write answers with PostgreSQL SALES DATABASE Cashier (id Number, name, phoneNumber, email) Supplier (taxNumber, name, phoneNumber, email, number Ofinvoices, totalofinvoices, averageOfBills) Product (barcode, name,

Please write answers with PostgreSQL

Please write answers with PostgreSQL SALES DATABASE Cashier (id Number, name, phoneNumber,

email) Supplier (taxNumber, name, phoneNumber, email, number Ofinvoices, totalofinvoices, averageOfBills) Product (barcode,

SALES DATABASE Cashier (id Number, name, phoneNumber, email) Supplier (taxNumber, name, phoneNumber, email, number Ofinvoices, totalofinvoices, averageOfBills) Product (barcode, name, stockAmount, productTotalMargin, selling Price Trend) Invoice (invoiceNumber, date, total, taxNumber) // orders or purchases Product Invoice (invoiceNumber, barcode, amount, unit, unitPrice) Receipt (receiptNumber, dateTime, total, idNumber) // sales Receipt products (receiptNumber, barcode, amount, unit, unitPrice) 3. Could you please write those trigger(s) that update the "total" area in the Invoice table when it is necessary. TIPS: This trigger, which will run when a record is added, deleted, or updated in a data (barcode or amount or unitPrice areas) to the Product Invoice table, finds it's total value by summing the "amount x unitPrice" values in the Product Invoice. 4. Could you please write those trigger(s) that update the numberOfinvoices, totalofinvoices, averageOfBills areas in the Supplier table when it is necessary. TIPS: This trigger, which will work in case of adding or deleting datas to the Invoice table or updating the total value in this table, should indirectly use the trigger in question "2" because in the case of adding, deleting or updating a data to the Product invoice table, "the totalOfinvoices" and "averageOfBills" values in the Suppliers table will need to be recalculated

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 Databases Questions!