Question: Please answer b and c similar to answer in a Using the following base Tables: Product(maker, model, type) PC(model, speed, ram, hd, price) Suppose we
Please answer b and c similar to answer in a
Using the following base Tables:
Product(maker, model, type)
PC(model, speed, ram, hd, price)
Suppose we create the following View:
CREATE VIEW NewPC AS
SELECT maker, model, speed, ram, hd, price
FROM Product, PC
WHERE Product,model = PC.model AND type = PC;
Notice that we have made a check for consistency: that the model number not only appears in the PC relation, but the type attribute of Product indicates that the product is a PC.
b) Write an instead-of trigger to handle an insertion into the view?
CREATE TRIGGER NewPCInsert
INSTEAD OF INSERT ON NewPC
REFERENCING NEW ROW AS NewRow
FOR EACH ROW
(INSERT INTO Product VALUES(NewRow.maker, NewRow.model, pc))
(INSERT INTO PC VALUES(NewRow.model, NewRow.speed, NewRow.ram, NewRow.hd, NewRow.price));
c) Write an instead-of trigger to handle an update of the price?
d) Write an instead-of trigger to handle a deletion of a specified tuple from this view?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
