Consider a relation schema MyAccount (StockSymbol, Quantity, Price), which records the user's stock holdings: the name of the stock, quantity, and current price. StockSymbol is a key. The user wants a small window on her desktop to show the following view:
CREATE VIEW MyTotals(StockSymbol, Total) AS
SELECT M.StockSymbol, M.Quantity * M.Price
FROM MyAccount M
The stock broker allows the user to compute the value of the view only once a day, so periodic
recomputation of the view is not an option. However, the broker allows triggers that re
whenever an update to the rows of MyAccount occurs. Write a row-level trigger that can
provide the user with an up-to-date view of the above kind.
CREATE TRIGGER StockViewTrigger
AFTER UPDATE OF Quantity, Price ON MyAccount
REFERENCING NEW AS N
FOR EACH ROW
WHEN (N.StockSymbol IN ( SELECT * FROM MyAccount))
UPDATE MyTotals
SET Total = N.Price*N.Quality
WHERE StockSymbol = N.StockSymbol
Computer Science & Information Technology
You might also like to view...
Which of the following is the main goal of the object-oriented approach?
A) maintaining systems B) minimizing the impact of change C) re usability D) functional control
Computer Science & Information Technology
Which cipher is made from a table of 26 distinct cipher alphabets?
A. Vernam B. Polyalphabetic substitution C. Caesar D. Vigenère Square
Computer Science & Information Technology
Suppose that you had to assign specific IT staff members to maintain the inventory control system. How would you accomplish the task? Describe your strategy in a brief memo.
What will be an ideal response?
Computer Science & Information Technology
A bootable Linux USB flash drive or CD that can be used to repair system issues is known by what term, respectively?
A. Live USB or CD B. Repair USB or CD C. Boot USB or CD D. Supplemental OS
Computer Science & Information Technology