Page 39 of 72
{ < id,n,b,a,s,d > ∣ < id,n,b,a,s,d > ∈ EMPLOYEE ∧ s > 30 . 000 }
Query 2: Find the name, address of employees who works for department number 1
{ < n,a > ∣ ∃ id,b,s,d ( < id,n,b,a,s,d > ∈ EMPLOYEE ∧ d = 1 ) }
Query 3: Find the name of the department that employee John works for.
{ < dn > ∣ ∃ di,o,m ( < di,dn,o,m > ∈ DEPARTMENT ∧ ∃ id,n,b,a,s,d ( < id, n, b, a, s,
d > ∈ EMPLOYEE ∧ ( n = John ∧ d = di ) ) ) }
Query 4: Find the SSN, start date of the employees who works for project number P1 or project
number P2
{ < en,sd > ∣ ∃ p ( < en,p,sd > JOIN ∧ ( p = 1 ∨ p = 2 ) ) }
Query 5: Find the name, relationship of all the dependents of employees who works for
Department Human Resource
{ en,name, r ∣ ∃ bd ( < en,name,bd,r > ∈ EMP-DEPENDENT ∧
∃ id,n,b,a,s,d ( < id, n, b, a, s,d > ∈ EMPLOYEE ∧
( en = id ∧ ∃ di, dn, o, m ( < di, dn, o, m > ∈ DEPARTMENT ∧ di = d ∧ dn = 'Human
Resource' ) ) ) ) }
Query 6: Finds the name of the employees who join in every project.
{ name ∣ ∃ id,n,b,a,s,d ( < id, n, b, a,
s,d > ∈ EMPLOYEE ∧ ∀ c,pn,b,dept ( < c,pn,b,dept > ∈ PROJECT
⇒ ( ∃ emp, proj, s ( < emp, proj, s > ∈ JOIN ∧ proj = c ∧ emp = id ) ) ) ) }
Query 7: Finds the names of the employees who have no dependent
n { ∣ ∃ id,n,b,a,s,d ( < id,n, b, a, s,d > ∈ EMPLOYEE ∧
¬ ( ∃ en, dn, bd, r ( < en,dn,bd,r > ∈ EMP-DEPENDENT ∧ id = en ) ) ) }
Safety of the expression
As we mentioned before, in Tuple Relational Calculus, it is possible to write expressions that
may generate infinite relation. The same situation arises for Domain Relational Calculus.