Expressing Constraints Formally I have been asked a question related to database constraints. I am familiar with Oracle DDLs and DMLs and know how to define FK, PK and standard constraints related to relations / tables using DDL. 

What I am not so sure of was when I was asked to present constraints formally using Relational Calculus.

So my question is:

Can someone provide an example of a simple constraint expressed formally using Relational Calculus?
Relational calculus is a notation for expressing relation values in terms of given named relations and sometimes constants. So is relational algebra. A constraint is an expression making a statement about one or more relation values. But such a statement is not relation-valued, so you can't express it in relation-valued notation alone. (So you need to ask what exactly is wanted.)

You have to have operators returning equality of relations, or whether a relation is empty, etc. (Either of those two is sufficient.)

-- every teacher is a person
empty({&lt;id&gt;|(exists class Teaches(id, class)) and not Person(id)})


A query is typically like {tuple|formula}. You could use an expression like the formula part of a query if you consider any free variables/attributes to be implicitly universally quantified. (This is also sufficient.)

-- id is a superkey of Teaches
-- forall id, c1, c2
    Teaches(id, c1) and Teaches(id, c2) implies c1=c2


(empty({&lt;...&gt;|formula}) is the same as forall ... notformula.)