31.8k views
1 vote
Suppose that only accept price from 1 to 100 in relation Product( Id, name, price). What relation algebra is used to express this constraint?

Select one:
a. sprice>=1AND price<=100 (Product)=Æ
b. sprice<1 OR price>100 (Product)=Æ
c. sprice<1 OR sprice>100 (Product)=Æ
d. sprice<1 AND sprice>100 (Product)=Æ

User Kcvin
by
7.0k points

1 Answer

7 votes

Final answer:

The correct answer to the student's question about relational algebra for a price constraint is option b, which ensures that no products have a price outside the range of 1 to 100.

Step-by-step explanation:

The student is asking about how to represent a constraint in relation algebra for a database. The constraint in question is that the price attribute of the Product relation should only accept values from 1 to 100. The correct relational algebra expression to ensure this constraint is that the set of products with prices less than 1 or greater than 100 should be empty.

The correct option is:
b. sprice<1 OR price>100 (Product)=Æ

This translates to "Select all products where the price is less than 1 or greater than 100. The result should be an empty set." This ensures that no product has a price outside of the 1 to 100 range, adhering to the law of supply which states that a higher price tends to lead to a greater quantity supplied, and a lower price to a lower quantity supplied, given all other variables are held constant.

User Lecardo
by
7.2k points