Database transaction 6.6.7 Exercises for Section 6.6 Exercise 6.6.1: This and th
ID: 659481 • Letter: D
Question
Database transaction 6.6.7 Exercises for Section 6.6 Exercise 6.6.1: This and the next exercises involve certain programs that operate on the two relations Product(maker, model, type) PC(model, speed, ram, hd, price from our running PC exercise. Sketch the following programs, including SQL statements and work done in a conventional Language. Do not forget to issue BEGIN TRANSACTION, COMMIT, and ROLLBACK statements at the proper times and to tell the system your transactions are read-only if they are. a) Given a speed and amount of RAM (as arguments of the function), look 4 up the PC's with that speed and RAM, printing the model number and price of each. b) Given a model number, delete the tuple for that model from both PC and Product. c) Given a model number, decrease the price of that model PC by $100Explanation / Answer
A)
CREATE OR REPLACE FUNCTION MODEL_PRICE_FUNC (SPD ,RM)
RETURN CHAR(20)
IS
MODEL CHAR;
PRICE CHAR;
BEGIN
SELECT MODEL,PRICE INTO MODEL, PRICE FROM PC WHERE SPEED= SPD AND RAM =RM;
END;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.