• Home
  • Textbooks
  • Database Systems: A Practical Approach to Design, Implementation and Management
  • Relational Algebra and Relational Calculus

Database Systems: A Practical Approach to Design, Implementation and Management

Thomas M. Connolly, Carolyn E. Begg

Chapter 4

Relational Algebra and Relational Calculus - all with Video Answers

Educators


Chapter Questions

04:37

Problem 1

What is the difference between a procedural and a non-procedural language? How would you classify the relational algebra and relational calculus?

Kris Bright
Kris Bright
Numerade Educator

Problem 2

Explain the following terms:
(a) relationally complete
(b) closure of relational operations.

Check back soon!
01:41

Problem 3

Define the five basic relational algebra operations. Define the Join, Intersection, and Division operations in terms of these five basic operations.

Adriano Chikande
Adriano Chikande
Numerade Educator
02:04

Problem 4

Discuss the differences between the five Join operations: Theta join, Equijoin, Natural join, Outer join, and Semijoin. Give examples to illustrate your answer.

Adriano Chikande
Adriano Chikande
Numerade Educator
04:37

Problem 5

Compare and contrast the tuple relational calculus with domain relational calculus. In particular, discuss the distinction between tuple and domain variables.

Kris Bright
Kris Bright
Numerade Educator
01:56

Problem 6

Define the structure of a (well-formed) formula in both the tuple relational calculus and domain relational calculus.

Heather Zimmers
Heather Zimmers
Numerade Educator

Problem 7

Explain how a relational calculus expression can be unsafe. Illustrate your answer with an example. Discuss how to ensure that a relational calculus expression is safe.

Check back soon!

Problem 8

For the following exercises, use the Hotel schema defined at the start of the Exercises at the end of Chapter 3.
Describe the relations that would be produced by the following relational algebra operations:
(a) $\Pi_{\text {hoteleno }}\left(\sigma_{\text {price }}>50(\right.$ Room $\left.)\right)$
(b) $\sigma_{\text {Hotel.hotelNo }=\text { finom.hotelNo }}($ Hotel $\times$ Room $)$
(d) Guest $\supset \triangleleft\left(\sigma_{\text {date To } \geq 1-J a n \cdot 2002}\right.$ (Booking $\left.)\right)$
(e) Hotel $\triangleright$ Hotel.hoteNo $=$ Room.hoblino $\left(\sigma_{\text {price }}>50(\right.$ Room $\left.)\right)$

Check back soon!

Problem 9

For the following exercises, use the Hotel schema defined at the start of the Exercises at the end of Chapter 3.
Provide the equivalent tuple relational calculus and domain relational calculus expressions for each of the relational algebra queries given in Exercise 4.8.

Check back soon!

Problem 10

For the following exercises, use the Hotel schema defined at the start of the Exercises at the end of Chapter 3.
Describe the relations that would be produced by the following tuple relational calculus expressions:
(a) \{H.hotelName $\mid$ Hotel $(\mathrm{H}) \wedge \mathrm{H}$.city $=$ 'London'\}
(b) $\{$ H.hotelName $\mid \operatorname{Hotel}(\mathrm{H}) \wedge(\exists R)($ Room $(\mathrm{R}) \wedge \mathrm{H}$.hotelNo $=$ R.hotelNo $\wedge$ R.price $>50)\}$
(c) $\{$ H.hotelName $\mid \operatorname{Hotel}(\mathrm{H}) \wedge(\exists B)(\exists G)($ Booking $(\mathrm{B}) \wedge \mathrm{Guest}(\mathrm{G}) \wedge$ H.hotelNo $=$ B.hotelNo $\wedge$ B.guestNo $=$ G.guestNo $\wedge$ G.guestName $=$ 'John Smith') $\}$ Booking $(B 1) \wedge$ Booking $(B 2) \wedge$ H.hotelNo $=B 1$.hotelNo $\wedge$ G.guestNo $=B 1$. guestNo $\wedge$ $B 2 \cdot$ hotelNo $=B 1$.hotelNo $\wedge$ B2.guestNo $=B 1$.guestNo $\wedge$ B2.dateFrom $\neq B 1$.dateFrom $\}$

Check back soon!

Problem 11

For the following exercises, use the Hotel schema defined at the start of the Exercises at the end of Chapter 3.
Provide the equivalent domain relational calculus and relational algebra expressions for each of the tuple relational calculus expressions given in Exercise 4.10.

Check back soon!

Problem 12

For the following exercises, use the Hotel schema defined at the start of the Exercises at the end of Chapter 3.
Generate the relational algebra, tuple relational calculus, and domain relational calculus expressions for the following queries:
(a) List all hotels.
(b) List all single rooms with a price below $£ 20$ per night.
(c) List the names and cities of all guests.
(d) List the price and type of all rooms at the Grosvenor Hotel.
(e) List all guests currently staying at the Grosvenor Hotel.
(f) List the details of all rooms at the Grosvenor Hotel, including the name of the guest staying in the room, if the room is occupied.
(g) List the guest details (guestNo, guestName, and guestAddress) of all guests staying at the Grosvenor Hotel.

Check back soon!

Problem 13

For the following exercises, use the Hotel schema defined at the start of the Exercises at the end of Chapter 3.
Using relational algebra, create a view of all rooms in the Grosvenor Hotel, excluding price details. What are the advantages of this view?

Check back soon!

Problem 14

For the following exercises, use the Hotel schema defined at the start of the Exercises at the end of Chapter 3.
Analyze the RDBMSs that you are currently using. What types of relational language does the system provide? For each of the languages provided, what are the equivalent operations for the eight relational algebra operations defined in Section 4.1?

Check back soon!