171k views
2 votes
Write a relational algebra expression to produce a relation containing all hotel names.

a) πhotelName(Hotel)

b) σhotelName(Hotel)

c) Hotel ∪ hotelName

d) rhohotelName(Hotel)

1 Answer

4 votes

Final answer:

The correct relational algebra expression to retrieve all hotel names is 'a) πhotelName(Hotel)', which uses the projection operator to select the hotelName column from the Hotel relation.

Step-by-step explanation:

To produce a relation containing all hotel names from the Hotel relation in relational algebra, the correct expression is a) πhotelName(Hotel). This expression uses the projection operator (π), which creates a new relation with selected columns from an existing relation. In this case, it selects the hotelName column from the Hotel relation.

Option b) σhotelName(Hotel) utilizes the selection operator (σ), which is used to select rows that satisfy a given predicate, not columns. Option c) Hotel ∪ hotelName is not meaningful in this context, as ∪ represents union and there's no indication that hotelName is a relation. Similarly, d) rhohotelName(Hotel) is incorrect because rho is the rename operator and the syntax is not appropriate in this context.

User Kevin Askin
by
7.6k points