Re: The wonderful world of keys
Date: 24 Jan 2007 23:11:19 -0800
Message-ID: <1169709079.462811.103990_at_h3g2000cwc.googlegroups.com>
On Jan 24, 8:59 am, "JOG" <j..._at_cs.nott.ac.uk> wrote:
>
> I have always considered keys in terms of functional
> dependencies/determinants, and was trying to reword it in the
> terminology of logic. I liked the idea of describing a key using "if
> then" to explain why there cannot be any other consequent values, and
> so why (logically) the column has to be a unique, because I could then
> analogise to java students (who always have trouble with this sort of
> thing) why its nonsensical to have duplicate key values with a bit of
> code like:
>
> switch (empID)
> {
> case 1: salary = 20000; break;
> case 1: salary = 30000; break;
>
> }
Works for me.
> But on considering the possibility of a relation having a superkey
> which includes all its attributes, and hence where there is no material
> implication at all in its describing predicate, I ran into a bit of a
> mental block. Perhaps my analogy is awry, I'm not certain, as I seem
> then to be saying in this case that there is nothing on the other side
> of the -> implication, other than a 'true'. Perhaps this is ok?
> Thoughts welcome.
Small point: *every* relation has a superkey which includes all its
attributes.
(Put another way: for all relations R, all of R's attributes form a
superkey.)
You probably meant: a relation having a minimal key which includes all
its attributes.
So, I don't see anything wrong with having nothing on either the left or the right side of the "->". One could think of both sides as being in conjunctive normal form, and an empty expression is just the conjunction of zero terms.
Consider how you would express a boolean function as a relation. Let's take less-than. You *could* think of it as a relation of three attributes:
x:int, y:int -> result:boolean
But it is cleaner to consider it instead as
{ x, y | x < y }
A relation on two attributes. And what is the functional dependency of the above?
x, y ->
Marshall Received on Thu Jan 25 2007 - 08:11:19 CET