0% found this document useful (0 votes)
837 views2 pages

800 Price and 3.00 Speed: PC Laptop X

The document provides 6 examples of using relational algebra to define constraints on relationships between attributes in different relations. Specifically: 1) A PC with speed < 3.00 must have price <= $800. 2) A laptop with screen < 15.4 inches must have HDD >= 120GB or price < $1000. 3) If a laptop has more RAM than a PC, the laptop must have higher price. 4) No manufacturer can make both PCs and printers. 5) Extends example 4 to include a PRODUCT relation. 6) Higher model PC must have higher price, and with same model higher specs must have higher price.

Uploaded by

na
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
837 views2 pages

800 Price and 3.00 Speed: PC Laptop X

The document provides 6 examples of using relational algebra to define constraints on relationships between attributes in different relations. Specifically: 1) A PC with speed < 3.00 must have price <= $800. 2) A laptop with screen < 15.4 inches must have HDD >= 120GB or price < $1000. 3) If a laptop has more RAM than a PC, the laptop must have higher price. 4) No manufacturer can make both PCs and printers. 5) Extends example 4 to include a PRODUCT relation. 6) Higher model PC must have higher price, and with same model higher specs must have higher price.

Uploaded by

na
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Ex1.

Give a schema: PC (Model, Speed, RAM, HDD, Price)


❖Use Relational Algebra to express following constraints:
A PC with a processor speed less than 3.00 must not sell for more
than $800

 speed3.00 and Price 800  PC   


Ex2. Give a schema: LAPTOP (Model, speed, RAM, HDD, Screen, Price)
❖Use Relational Algebra to express following constraints:
A laptop with a screen size less than 15.4 inches must have at least
a 120GB hard disk or sell for less than $1000

 screen 15.4 and (HHD 120 and Price 1000)  PC   


Ex3.
PC (Model, Speed, RAM, HDD, Price)
LAPTOP (Model, speed, RAM, HDD, Screen, Price)
❖Use Relational Algebra to express following constraints: If a
laptop has a larger RAM than a PC, then the laptop must also have a
higher price than the PC

 Laptop.RAM  PC.RAM and Laptop.price  PC.price  Laptop x PC   


Ex4.
PC (Maker, Model)
PRINTER (Maker, Model)
❖Use Relational Algebra to express following constraints: No
manufacturer of PC’s may also make printers

 PC.maker  Printer.maker  PC x Printer   


Ex5.
❖PRODUCT (Maker, model)
❖PC (Model, speed, ram, hd, price)
❖PRINTER (Model, color, type, price)
❖Use Relational Algebra to express following constraints: No
manufacturer of PC’s may also make printers

R1 : (PC  Product )
R 2 : (Printer  Product )
 R2.maker  R1.maker  R1 x R2  
Ex6.
❖PC (Model, Speed, RAM, HDD, Price)
❖Use Relational Algebra to express following constraints:
▪ Higher model, higher price
▪ With the same model, higher Speed and RAM and HDD, higher price
R1 : PC
 R1.model  PC.model and R1.price  PC.price  R1 x PC    and
 R1.model  PC.model and (R1.Speed  PC.Speed and R1.RAM  PC.RAM and R1.HHD  PC.HHD) and (R1.price  PC.price)  R1 x PC   

You might also like