0

I'm having trouble understanding how to provide proper relational algebra expressions to some of my assignment problems. I realized instead of having the JOIN selection operator outside the relation instance, maybe I can put it also inside it. I'm sorry if I don't make much sense but here's what I am thinking about:

The question is

Find the name of all employees whose salary is more than 15,000.00 and managed by Paul

WORKS (employee-name, company-name, salary)

MANAGES (employee-name, manager-name, position)

My answer is Π(employee-name) ((MANAGES⋈(σ(salary > 15000 ∧ manager-name="Paul")(WORKS))) https://i.stack.imgur.com/ZQ6ZM.png

But should I just instead do this Π(employee-name) (( σ(salary > 15000 ∧ manager-name="Paul")(WORKS⋈MANAGES) https://i.stack.imgur.com/6nwIy.png

Nick
  • 9
  • 5

1 Answers1

0

The problem with your solution is the right operand of the JOIN:

σ(salary > 15000 ∧ manager-name="Paul")(WORKS)

the attribute manager-name is inside MANAGES, not WORKS, so you cannot use it in the restriction. The correct solution is either the second one, or alternatively, the following:

Π(employee-name) ((σ(manager-name="Paul")(MANAGES))⋈(σ(salary > 15000)(WORKS)))

Renzo
  • 26,848
  • 5
  • 49
  • 61
  • Ohhhh I get the difference now....I'll be applying that knowledge in more of my assignments. Thank you so much! – Nick Jun 29 '21 at 16:45