Lab SPTG Test
Lab SPTG Test
1. Exercise 9.4.2: Write the following PSM functions or procedures, based on the database
schema
Product(maker, model, type)
PC(model, speed, ram, hd, price)
Laptop(model, speed, ram, hd, screen, price)
Printer(model, color, type, price)
a) Take a price as argument and return the model number of the PC whose price is
closest.
b) Take a maker and model as arguments, and return the price of whatever type of
product that model is.
c) Take model, speed, ram, hard-disk size, and price information as arguments, and insert
this information into the relation PC. However, if there is already a PC with that model
number (tell by assuming that violation of a key constraint on insertion will raise an
exception, then keep adding 1 to the model number until you find a model number that is
not already a PC model number.
pg. 1