Let (A, B, C) mean (Rank, Name, ID) in the Enterprise relation
and let (D, E, F) mean (Name, DeptName, ID) in the Department relation
All captains of the starship USS Enterprise: { ⟨ A , B , C ⟩ ∣ ⟨ A , B , C ⟩ ∈ E n t e r p r i s e ∧ A = ′ C a p t a i n ′ } {\displaystyle \left\{\ {\left\langle A,B,C\right\rangle }\mid {\left\langle A,B,C\right\rangle \in \mathrm {Enterprise} \ \land \ A=\mathrm {'Captain'} }\ \right\}}
In this example, A, B, C denotes both the result set and a set in the table Enterprise.
Names of Enterprise crew members who are in Stellar Cartography: { ⟨ B ⟩ ∣ ∃ A , C ⟨ A , B , C ⟩ ∈ E n t e r p r i s e ∧ ∃ D , E , F ⟨ D , E , F ⟩ ∈ D e p a r t m e n t s ∧ F = C ∧ E = ′ S t e l l a r C a r t o g r a p h y ′ } {\displaystyle {\begin{aligned}\{{\left\langle B\right\rangle }&\mid {\exists A,C\ \left\langle A,B,C\right\rangle \in \mathrm {Enterprise} }\\&\land \ {\exists D,E,F\ \left\langle D,E,F\right\rangle \in \mathrm {Departments} }\\&\land \ F=C\\&\land \ E=\mathrm {'Stellar\ Cartography'} \}\\\end{aligned}}}
In this example, we're only looking for the name, and that's B. The condition F = C is a requirement that describes the intersection of Enterprise crew members AND members of the Stellar Cartography Department.
An alternate representation of the previous example would be: { ⟨ B ⟩ ∣ ∃ A , C ⟨ A , B , C ⟩ ∈ E n t e r p r i s e ∧ ∃ D ⟨ D , ′ S t e l l a r C a r t o g r a p h y ′ , C ⟩ ∈ D e p a r t m e n t s } {\displaystyle {\begin{aligned}\{{\left\langle B\right\rangle }&\mid {\exists A,C\ \left\langle A,B,C\right\rangle \in \mathrm {Enterprise} }\\&\land \ {\exists D\ \left\langle D,\mathrm {'Stellar\ Cartography'} ,C\right\rangle \in \mathrm {Departments} }\}\\\end{aligned}}}
In this example, the value of the requested F domain is directly placed in the formula and the C domain variable is re-used in the query for the existence of a department, since it already holds a crew member's ID.
Both of them written in SQL will be like:
Michel Lacroix, Alain Pirotte: Domain-Oriented Relational Languages. VLDB 1977: 370-378 https://dl.acm.org/citation.cfm?id=1286620 ↩
E. F. Codd: Relational Completeness of Data Base Sub-languages. In R. Rustin, editor, Data Base Systems. Prentice Hall, 1972 /wiki/E._F._Codd ↩