0

Consider the following relational schemas (primary keys are in bold):

staff(staff id, name, monthly salary, address, phone number, role id);

role(role id, role name, role desc);

patient(pat id, pat name, pat address, pat contact, pat blood type);

appointment(date, time, staff id, pat id);

How do you write the list of names of ALL patients who had SEPARATE appointments with DIFFERENT doctors in relational algebra?

N.B. this is a question taken from exam revision that I'm stuck with!

P.S. a doctor can be found by selecting role_name="Doctor"

Naomi
  • 81
  • 1
  • 8
  • 1. Which version of relational algebra? (Details or reference please.) 2. What have you got so far? 3. See [this](http://stackoverflow.com/a/24425914/3404097). – philipxy May 23 '16 at 01:12

1 Answers1

0

I'm not sure about relational Algebra but in relational calculus, it would give:

the relational equation

yet, there is a mistake on the time constraint as far as here we will never be able to have an appointment at the same time either in one day or in two different days: for instance having an appointment on Monday at 1200 and the Tuesday at 1200 is forbidden here.

I will try to correct it and do in relational algebra and in SQL tomorrow if I have the time.

Good luck, though.

Revolucion for Monica
  • 2,848
  • 8
  • 39
  • 78