·Q2 [1 pt]: Write the following assertion to this schema: Product(maker, model,
ID: 3591737 • Letter: #
Question
·Q2 [1 pt]: Write the following assertion to this schema: Product(maker, model, type) PC(model, speed, ram, hd, price) hd: hard disk Laptop(model, speed, ram, hd, screen, price) Printer(model, color, type, price) a) No manufacturer of PC's may also make laptops? b) A manufacturer of a PC must also make a laptop with at least as great a processor speed? c) If a laptop has larger main memory than a PC, then the laptop must also have a higher price than the PC? d) If a relation Product mentions a model and its type, then this model must appear in the relation appropriate to that type?Explanation / Answer
Below is the assertions of the given schema.
a)
create assertion NO_MANUF_PC as CHECK
( not exists
( select maker
from Product p, PC pc
where p.model = pc.model
and p.type = ‘Laptop’)
);
b)
create assertion LAPTOP_PROCESSOR_SPEED as CHECK
(
( select maker
from Product p, PC pc
where p.model = pc.model
and lp.speed >= (select speed from PC))
);
c)
create assertion LAPTOP_HIGHER_PRICE as CHECK
(
( select lp.price
From Laptop lp
where lp.price > (select price from PC)
and lp.ram > (select ram from PC))
);
d)
create assertion MODEL_PC_LAPTOP as CHECK
(
( select model
from Product
where type IN (‘PC’, ‘Laptop’,’Printer))
);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.