domain relational calculus "for all" expression

373 Views Asked by At

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"

2

There are 2 best solutions below

0
On

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

0
On

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.