While Relational Algebra is a procedural language (you specify the sequence of operations), Relational Calculus is a non-procedural (declarative) language. You describe WHAT you want, not HOW to get it. SQL is based heavily on Relational Calculus.
In TRC, queries are of the form: {t | P(t)} — "the set of all tuples $t$ such that predicate $P(t)$ is true."
Example: Find all employees with salary greater than 50000:
{t | t ∈ Employee ∧ t.salary > 50000}
Example with quantifiers: Find names of employees who work in the 'CS' department:
{t.name | t ∈ Employee ∧ ∃d ∈ Department (t.dept_id = d.id ∧ d.name = 'CS')}
In DRC, variables represent individual attribute values (domain values) rather than entire tuples.
Queries are of the form: {x_1, x_2, ..., x_n | P(x_1, x_2, ..., x_n)}
Example: Find the name and salary of employees in department 5:
{n, s | ∃i (Employee(i, n, s, 5))}
A relational calculus expression is safe if it guarantees a finite number of results. The expression {t | ¬(t ∈ Employee)} is unsafe because it returns all possible tuples that are NOT in the Employee table—an infinite set!
Relational Algebra, Tuple Relational Calculus, and Domain Relational Calculus are all relationally complete — they have the same expressive power. Any query that can be expressed in one can be expressed in the others. SQL is relationally complete.