Consider the subsequent relation schemes:
Project (Project#, Project_name, chief_architect)
Employee (Emp#, Empname)
Assigned_To (Project#, Emp#)
Give expression in Tuple calculus and Domain calculus for each of the queries below:
(i) Get the employee numbers of employees who work on all projects.
(ii) Get the employee numbers of employees who do not work on the COMP123 project.
Ans: (i) Tuple Calculus:
{t[Emp#] | t ∈ ASSIGNED_TO ∧ ∀p (p ∈ PROJECT ∃u (u ∈ ASSIGNED_TO ∧ p[Project#] = u[Project#] ∧ t[Emp#] = u[Emp#]))}
Domain Calculus:
{e | ∃p (
∈ ASSIGNED_TO ∧ ∀p1 ( ∈ PROJECT ∈ ASSIGNED_TO))}
(ii) Tuple Calculus:
{t[Emp#] | t ∈ ASSIGNED_TO ∧ ¬∃u (u ∈ ASSIGNED_TO ∧ u[Project#] = 'COMP123'∧ t[Emp#] = u[Emp#])}
Domain Calculus:
{e | ∃p (
∈ ASSIGNED_TO ∧ ∀p1, e1 ( ∉ ASSIGNED_TO ∨ p1 ≠ 'COMP123' ∨ e1 ≠ e))}