Mr-Ghahremani
Mr-Ghahremani

Reputation: 1

domain relational calculus "for all" expression

I have database of University like below:

Student (SID, name, family, mean, age, city, street, CID)
Instructor (IID, name, family, salary, city, street, CID)
College (CID, name, city)

How can i answer the following query in Domain Relational Calculus (DRC) ?

"Find instructors who are in all colleges located in London"

Upvotes: -1

Views: 406

Answers (2)

a.ndrea
a.ndrea

Reputation: 536

When you have to solve this kind of jobs, you have to follow these steps:

  1. Search for all instructors that are not in at least one college located in London
  2. Take the whole list of instructors and subtract from this list the list found at 1

Anyway, since your DB links through an external key (CID in Instructor) Instructors to Colleges, you can have at most ONE Instructor for College.

To be able to link more instructors to more college you have to insert one additional table to design an N:M relationship, like in here

Upvotes: 0

Erwin Smout
Erwin Smout

Reputation: 18408

Find all the instructors such that there does not exist any college located in London such that the instructor is not in that college.

But the question is a bit questionable given that your db structure seems to allow any instructor to "be in" at most one single college, at any time.

Upvotes: 1

Related Questions