must be in SQL SSMS format /*29. Write a trigger to update the CUST_BALANCE ON CUSTOMER TABLE when an invoice is deleted (INV_NUM) FROM INVOICE TABLE. Name the trigger trg_updatecustbalance2.*/ 30. Write a procedure to delete an invoice (INV_NUM) FROM INVOICE TABLE giving the invoice number as a parameter. Name the procedure prc_inv_delete. Test the procedure by deleting invoices 8005 and 8006.   TABLE STRUCTURE & CURRENT INV TABLE ARE ATTACHED

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

code must be in SQL SSMS format

/*29. Write a trigger to update the CUST_BALANCE ON CUSTOMER TABLE when an invoice is deleted (INV_NUM) FROM INVOICE TABLE. Name
the trigger trg_updatecustbalance2.*/

30. Write a procedure to delete an invoice (INV_NUM) FROM INVOICE TABLE giving the invoice number as a parameter.
Name the procedure prc_inv_delete. Test the procedure by deleting invoices 8005
and 8006.

 

TABLE STRUCTURE & CURRENT INV TABLE ARE ATTACHED

画Results
Messages
INV_NUM CUST_NUM INV_DATE
INV_AMOUNT
1
8000
1000
2016-03-23 235.89
2
8001
1001
2016-03-23 312.82
3
8002
1001
2016-03-30
528.10
4
8003
1000
2016-04-12 194.78
8004
1000
2016-04-23 619.44
8005
1001
2017-04-27 225.40
8006
1000
2018-04-30
302.00
67
Transcribed Image Text:画Results Messages INV_NUM CUST_NUM INV_DATE INV_AMOUNT 1 8000 1000 2016-03-23 235.89 2 8001 1001 2016-03-23 312.82 3 8002 1001 2016-03-30 528.10 4 8003 1000 2016-04-12 194.78 8004 1000 2016-04-23 619.44 8005 1001 2017-04-27 225.40 8006 1000 2018-04-30 302.00 67
dbo.CUSTOMER
Columns
mo CUST_NUM (PK, int, not null)
E CUST_LNAME (varchar(30), null)
E CUST_FNAME (varchar(30), null)
E CUST_BALANCE (decimal(9,2), nu
E CUST_ DOB (date, null)
Keys
Constraints
Triggers
Indexes
Statistics
dbo.EMP_1
dbo.EMP_2
dbo.EMPLOYEE
dbo.INVOICE
Columns
ro INV_NUM (PK, int, not null)
C- CUST_NUM (FK, int, null)
E INV_DATE (date, null)
E INV_AMOUNT (decimal(11,2), nul
Keys
Constraints
Triggers
Indexes
+
Statistics
dbo.JOB
dbo.PROJECT
Views
External Resources
囲回
田田
Transcribed Image Text:dbo.CUSTOMER Columns mo CUST_NUM (PK, int, not null) E CUST_LNAME (varchar(30), null) E CUST_FNAME (varchar(30), null) E CUST_BALANCE (decimal(9,2), nu E CUST_ DOB (date, null) Keys Constraints Triggers Indexes Statistics dbo.EMP_1 dbo.EMP_2 dbo.EMPLOYEE dbo.INVOICE Columns ro INV_NUM (PK, int, not null) C- CUST_NUM (FK, int, null) E INV_DATE (date, null) E INV_AMOUNT (decimal(11,2), nul Keys Constraints Triggers Indexes + Statistics dbo.JOB dbo.PROJECT Views External Resources 囲回 田田
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Multiple table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education