Re: Help with a relationship

From: --CELKO-- <>
Date: 22 Sep 2002 11:34:53 -0700
Message-ID: <>

>> What does SQL have a FOREIGN KEY clause when the CHECK clause would
 .. why do so many procedural languages have "if...then...else", when "switch" would suffice? <<

History. Tony Hoare invented the first version of the CASE expression for Algol-58 or Algol-60, and it showed up in a high level programming langage ten years later.

The PK-FK stuff was implemented first, as pointer constructs that would "pre-join" the referenced and referencing tables and allow the value to appear in one and only one physical location. Nobody really thought about them as predicates at first!

The CHECK() constraints can be passed along to the optimizer as part of the parse tree for queries as well as be checked. But until you get to full SQL-92, CHECK() did not work on multiple tables, so you could not write PK-FK stuff with them. Most products still do not have CREATE ASSERTION statements.

Now the idea is that everything in SQL should be expressed as a predicate and the SQL compiler is looking more like a specialized ProLog compiler. Received on Sun Sep 22 2002 - 20:34:53 CEST

Original text of this message