TITLE: Math behind databases management and SQL ?
QUESTION [7 upvotes]: Are there some mathematical theories/theorems/... behind modern development of database management systems and in particular of SQL ?
I am refreshing my knowledge of these things which are quite down-to-earth "how to use" (create table ..., insert..., select * from ...), but I think some deeper understanding what is behind would be helpful. 
In particular in Wikipedia one may find some relations with 3-valued logic: 

Along with True and False, the Unknown
  resulting from direct comparisons with
  Null thus brings a fragment of
  three-valued logic to SQL. The truth
  tables SQL uses for AND, OR, and NOT
  correspond to a common fragment of the
  Kleene and Lukasiewicz three-valued
  logic (which differ in their
  definition of implication, however SQL
  defines no such operation).

But it is not very clear for me what it means and how deep it is ?

REPLY [3 votes]: David Spivak (who is an occasional contributor here) has done some work on categorical aspects of database management, and the creation of dictionaries between math world and the DB world that allow one to prove that certain operations are well-behaved in a robust sense.  The link gives a list of his ArXiv papers.