• RBarryYoung (12/6/2009)How can a relational query "preserve keys" across relational operations like PROJECT and JOIN?

    Some examples:

    P = PROJECT(a,b) R

    If a is a key of R then a is a key of P

    If b is a key of R then b is a key of P

    Otherwise (a,b) is a key of P

    Q = S JOIN T

    The union of the key attributes of S and T is a superkey of Q (possibly a candidate key).

    Key inference rules exist for all the relational operations. It's just a natural consquence of the closure property, ie: every result is a relation and every relation has at least one key.