Create a SQL SERVER trigger named trg_line_total to write the LINE_TOTAL value in the LINE table every
Fantastic news! We've Found the answer you've been seeking!
Question:
Create a SQL SERVER trigger named trg_line_total to write the LINE_TOTAL value in the LINE table every time you add a new LINE row. (The LINE_TOTAL value is the productof the LINE_UNITS and LINE_PRICE values.)
2) Create a SQL SERVER trigger named trg_line_prod that automatically updates the quantity on hand for each product sold after a new LINE row is added.
Transcribed Image Text:
FIGURE P8.31 CH08_SALECO2 DATABASE TABLES Table name: CUSTOMER DUS CODE CUS LAMECUS FIAME CUS INITIAL CUS AREACODE CUS PHONE CUS DALANCE KEID Ramas 844-3575 10011 Du 864-1296 MAZM 100125 10013 O 054-2190 10014 O 222-1872 10015 442-1901 27-1225 200-256 K016 Dowe 10017 W 1010 10019 S Alhed Lara Kaly Pad Meren Avey Jur George Anne On Table name: PRODUCT CODE DESCRIPT 11GER Power partar, 15psi, 3ecz 13-00P3 125-p 14-0143 9.00- 1546-002 H 18, 20 1558MHck, 10, 350 2222TY DID 12 2212 880,- 223GRO BID codes, 10 2- Camer 2116-AA 12 54770-21, 1 E-9 Hot , 15 PVCORT PVC, 35,6 SM-16277125, 25 2123 DAE S 21344 Go Brs 2257 Dome Sply 23119 L 24004 Brackman Bro Table name: VENDOR V.CODE V NAME 21225 Brys, 21235 Supe, SN-2110 25 w WRITTS Seting, sh She Flushing Singh Oreg Sreth CONTACT Anderson P Browning 20ORDVA 2:40 BAKh 29901 Dan Spes 252525 Rubice BystreO K W F B Greth Breytte G 9 616 10 615 616 901 101 615 615 904 615 713 115 615 015 713 615 904 615 615 7103 615 302-7100 27-3000 206-09 587 6.99 845 $ 11595 VAREACCUEVPHONEY STATE V ONLER N 220-3034 TN 215006 FL 23 3246 TN 8003646 KY 6751419 GA 676-3990 GA 230-140 8-1234 TH 227-0000 FL 890-3529 TN 458-00000 FL am 0.00 N 345 56% 8:00 21344 23115 POATE OM HUPRICE DISCOUNT CODE 03-7 100.00 6:00 25525 8S 130-17 32 16 1490 0.06 21344 13-17 10 12 17.49 15-in-18 15 B 30.05 15--18 23 $ 4399 30-04-17 F 10092 24-17 6 S 2087 20-A-18 12 S 38.96 203 8:00 000 23119 0.05 24200 805 24300 605 25505 9.95 20-A-18 30-A-18 10 $ 14.40 0.10 21225 806 . 43 4.99 15-06-17 20 97-76-10 S 11 207-18 100 75 01-10 172 75 2476-10 237 100 17-18 000 0.00 221.15% 768.93 216 95 000 900 21344 0.05 6.00 0021225 000 21291 810 25005 Table name: INVOICE V JEMBER CUS CODE V DATE Y SUBTOTAL TAX NVSOTAL 1001 1.00 1001416--10 1001115--18 0.00 12.31 200 1002 1003 1004 1005 1006 1007 1008 5.04 TOEN 1001 1000 1000 1000 1000 1004 100k 1004 1006 10 100 www 1006 1006 Database name: Ch08_SaleCo2 1006 1007 1007 1008 1000 1000 10012 15-Jan-18 10011 17-18 10018 17--18 10014 17-Jan-18 10015 17-18 10011 17-18 Table name: LINE NY NUMBER UNE NUMBER | F CODE | LIRE_UNTS | LINE_PRICE | 113-0782 223109 15477637 122/OFO 21545-002 313-02P2 15477637 22210948 1 PYCZORY 10M411077 2 2230OTY 12110340 400 WRE-9 113-0202 25477627 PVCDAT 24.00 100 2 WROTTS 320 15305 34.97 70.44 307 34.37 39315 1 2 1 1 5 1 2 17 32 3 3 P 1 1 1 2 1 6 3 2183 2.00 31.90 1490 $96 89 38.96 30 14:00 AM 9.96 for 90 10 60 996 256.99 14.90 490 to 119.95 906 26.00 10.76 100 16 3777 76.08 42946 37 77 431 00 LINE TOTAL 1499 9.96 100 92 256 99 2990 490 29.35 29 996 FIGURE P8.31 CH08_SALECO2 DATABASE TABLES Table name: CUSTOMER DUS CODE CUS LAMECUS FIAME CUS INITIAL CUS AREACODE CUS PHONE CUS DALANCE KEID Ramas 844-3575 10011 Du 864-1296 MAZM 100125 10013 O 054-2190 10014 O 222-1872 10015 442-1901 27-1225 200-256 K016 Dowe 10017 W 1010 10019 S Alhed Lara Kaly Pad Meren Avey Jur George Anne On Table name: PRODUCT CODE DESCRIPT 11GER Power partar, 15psi, 3ecz 13-00P3 125-p 14-0143 9.00- 1546-002 H 18, 20 1558MHck, 10, 350 2222TY DID 12 2212 880,- 223GRO BID codes, 10 2- Camer 2116-AA 12 54770-21, 1 E-9 Hot , 15 PVCORT PVC, 35,6 SM-16277125, 25 2123 DAE S 21344 Go Brs 2257 Dome Sply 23119 L 24004 Brackman Bro Table name: VENDOR V.CODE V NAME 21225 Brys, 21235 Supe, SN-2110 25 w WRITTS Seting, sh She Flushing Singh Oreg Sreth CONTACT Anderson P Browning 20ORDVA 2:40 BAKh 29901 Dan Spes 252525 Rubice BystreO K W F B Greth Breytte G 9 616 10 615 616 901 101 615 615 904 615 713 115 615 015 713 615 904 615 615 7103 615 302-7100 27-3000 206-09 587 6.99 845 $ 11595 VAREACCUEVPHONEY STATE V ONLER N 220-3034 TN 215006 FL 23 3246 TN 8003646 KY 6751419 GA 676-3990 GA 230-140 8-1234 TH 227-0000 FL 890-3529 TN 458-00000 FL am 0.00 N 345 56% 8:00 21344 23115 POATE OM HUPRICE DISCOUNT CODE 03-7 100.00 6:00 25525 8S 130-17 32 16 1490 0.06 21344 13-17 10 12 17.49 15-in-18 15 B 30.05 15--18 23 $ 4399 30-04-17 F 10092 24-17 6 S 2087 20-A-18 12 S 38.96 203 8:00 000 23119 0.05 24200 805 24300 605 25505 9.95 20-A-18 30-A-18 10 $ 14.40 0.10 21225 806 . 43 4.99 15-06-17 20 97-76-10 S 11 207-18 100 75 01-10 172 75 2476-10 237 100 17-18 000 0.00 221.15% 768.93 216 95 000 900 21344 0.05 6.00 0021225 000 21291 810 25005 Table name: INVOICE V JEMBER CUS CODE V DATE Y SUBTOTAL TAX NVSOTAL 1001 1.00 1001416--10 1001115--18 0.00 12.31 200 1002 1003 1004 1005 1006 1007 1008 5.04 TOEN 1001 1000 1000 1000 1000 1004 100k 1004 1006 10 100 www 1006 1006 Database name: Ch08_SaleCo2 1006 1007 1007 1008 1000 1000 10012 15-Jan-18 10011 17-18 10018 17--18 10014 17-Jan-18 10015 17-18 10011 17-18 Table name: LINE NY NUMBER UNE NUMBER | F CODE | LIRE_UNTS | LINE_PRICE | 113-0782 223109 15477637 122/OFO 21545-002 313-02P2 15477637 22210948 1 PYCZORY 10M411077 2 2230OTY 12110340 400 WRE-9 113-0202 25477627 PVCDAT 24.00 100 2 WROTTS 320 15305 34.97 70.44 307 34.37 39315 1 2 1 1 5 1 2 17 32 3 3 P 1 1 1 2 1 6 3 2183 2.00 31.90 1490 $96 89 38.96 30 14:00 AM 9.96 for 90 10 60 996 256.99 14.90 490 to 119.95 906 26.00 10.76 100 16 3777 76.08 42946 37 77 431 00 LINE TOTAL 1499 9.96 100 92 256 99 2990 490 29.35 29 996
Expert Answer:
Answer rating: 100% (QA)
To create SQL Server triggers for the specified requirements you can use the following trigger defin... View the full answer
Related Book For
Concepts of Database Management
ISBN: 978-111182591
7th edition
Authors: Philip J. Pratt, Joseph J. Adamski
Posted Date:
Students also viewed these databases questions
-
The monthly high and low levels of direct labor hours and total manufacturing overhead costs for Onyx Company are as shown: Level Direct Labor Hours Manufacturing Overhead Costs Highest observed...
-
Create the ERD. Use the database shown in Figure P3.24 to answer this Problem. ROBCOR is an aircraft charter company that supplies on-demand charter flight services using a fleet of four aircraft....
-
Create the relational diagram. Use the database shown in Figure P3.24 to answer this Problem. ROBCOR is an aircraft charter company that supplies on-demand charter flight services using a fleet of...
-
Which step in the recruitment process involves attracting potential candidates to the organization? A. Selection B. Induction C. Job analysis D. Sourcing
-
Derive the expressions for the energy and energy-loss curves shown in Figure 3-8 for the damped oscillator. For a lightly damped oscillator, calculate the average rate at which the damped oscillator...
-
Provide a specific emotional reaction of a situation you were in. Then explain the emotional reaction using two different theories of emotions. Finally, provide an argument for which of the two...
-
Consider the simple linear regression model fit to the solar energy data in Problem 2.3. Problem 2.3 Table B. 2 presents data collected during a solar energy project at Georgia Tech. a. Construct a...
-
Historically, technology firms have been the most aggressive users of stock-based compensation in the form of stock options granted to almost all employees of the firms. What is the rationale for...
-
Sweet Treats Beverage Company's operating activities for the year are listed below. Purchases Operating expenses Beginning inventory Ending inventory Sales revenue $140,600 80,800 12,400 18,100...
-
Suppose the current USD/euro exchange rate is 1.2000 dollar per euro. The six month forward exchange rate is 1.1950. The six month USD interest rate is 1% per annum continuously compounded? Estimate...
-
Eagle Paving believes that its paving machine will need replacing in 10 years. The president estimates that a new one will cost $500,000 by then. The financial officer establishes a sinking fund to...
-
Diamantis Masoutis S.A., a Greek supermarket chain, borrowed 250,000 under a line-of-credit agreement. Although the company normally maintains a checking account balance of 15,000 in the lending...
-
Conad, an Italian supermarket chain, is considering two mutually exclusive projects. Each project requires an initial investment (CF 0 ) of 1,000,000. Francesco Pugliese, the general director of...
-
Alumina Ltd. is considering establishing a zero-balance account. The company currently maintains an average of A$1,380,000 in its disbursement account. As compensation to the bank of maintaining the...
-
Anki is a Finnish manufacturer of rugs. Last year, it sold rugs for 350, with a variable operating cost of 200 per rug and a fixed operating expense of 1,050,000. a. How many rugs must Anki sell this...
-
Antonio and his friend, Giancarlo, are both talented painters. Last year they began painting original artistic postcards, which they gave to their friends as holiday gifts. In addition, they began...
-
Write an equation for the line that passes through (-6,5) and whose slope is undefined. Give an answer in standard form. Write the equation in the standard form where all coefficients are expressed...
-
(a) Prove that form an orthonormal basis for R3 for the usual dot product. (b) Find the coordinates of v = (1, 1, 1)T relative to this basis. (c) Verify formula (5.5) in this particular case. 48-65...
-
What are the DBAs database design responsibilities?
-
List the functional dependencies in the following table that concerns invoicing (an application Premiere Products is considering adding to its database), subject to the specified conditions. For a...
-
Define candidate key.
-
Understanding the Feds actions that are needed to stabilize the interest rate The diagram below shows three different money demand curves and a target interest rate i*. Fill in the table below using...
-
This section looks at US recessions over the past 60 years. To work out this problem, first obtain quarterly data on US output growth for the period 1960 to the most recent data from www.bea.gov....
-
This question asks you to examine the movements of investment and consumption before, during and after the recession of 2001. It also asks you to consider the response of investment and consumption...
Study smarter with the SolutionInn App