dbTalk Databases Forums  

What are the differences between the terms, CANDIDATE KEY, PRIMARY KEY, SUPER KEY, COMPOSITE KEY?

comp.databases.theory comp.databases.theory


Discuss What are the differences between the terms, CANDIDATE KEY, PRIMARY KEY, SUPER KEY, COMPOSITE KEY? in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #51  
Old   
JOG
 
Posts: n/a

Default Re: MV Keys (was: Key attributes with list values) - 02-26-2006 , 09:13 PM






Marshall Spight wrote:
Quote:
David Cressey wrote:
"mAsterdam" <mAsterdam (AT) vrijdag (DOT) org> wrote

If I change the order of the items in the list,
does that make it a new key? I would think so. (See below)

In other words, an onion and mushroom pizza is different from a mushroom and
onion pizza.

Here we go again.

Ha ha!

I've always maintained that any question about whether a collection
is ordered or not (such as a collection of pizza toppings) is a
question of domain modelling. The question of whether
onion, mushroom = mushroom, onion is exactly the question
of whether this particular collection is considered ordered
in this particular domain. To answer that, we need a
domain expert.


Marshall
Yes! This point is crucial and why (dawn one should desperately
avoid the conceptual squashing of sets, multisets, orderings, peruvian
monkey fish, etc., into a single catchall "list" construct.

It isn't just about the pros and cons of passing cognitive load onto
the user, its about allowing the system to be capable of maintaining
integrity and making formally correct decisions. As far as I can see,
the domain expert that Marshall specifies above can and *should be* the
system itself, as defined to it at design time when the domain was
specified.



Reply With Quote
  #52  
Old   
dawn
 
Posts: n/a

Default Re: MV Keys (was: Key attributes with list values) - 02-26-2006 , 09:31 PM







JOG wrote:
Quote:
Marshall Spight wrote:
David Cressey wrote:
"mAsterdam" <mAsterdam (AT) vrijdag (DOT) org> wrote

If I change the order of the items in the list,
does that make it a new key? I would think so. (See below)

In other words, an onion and mushroom pizza is different from a mushroom and
onion pizza.

Here we go again.

Ha ha!

I've always maintained that any question about whether a collection
is ordered or not (such as a collection of pizza toppings) is a
question of domain modelling. The question of whether
onion, mushroom = mushroom, onion is exactly the question
of whether this particular collection is considered ordered
in this particular domain. To answer that, we need a
domain expert.


Marshall

Yes! This point is crucial and why (dawn one should desperately
avoid the conceptual squashing of sets, multisets, orderings, peruvian
monkey fish, etc., into a single catchall "list" construct.

It isn't just about the pros and cons of passing cognitive load onto
the user, its about allowing the system to be capable of maintaining
integrity and making formally correct decisions. As far as I can see,
the domain expert that Marshall specifies above can and *should be* the
system itself,
Would that the domain expert were the system -- it would be so less
likely to change its mind. But, yes, I agree that when you store sets
or monkey fish in a list, you are bound to encounter some issues where
it would be better for the system to have the information that this is,
indeed, a set or a monkey fish and not a list.

Quote:
as defined to it at design time when the domain was
specified.
And redesigned in subsequent projects as requirements change. So, yes,
I agree with you in theory, but I'm hedging related to practice.
--dawn



Reply With Quote
  #53  
Old   
Mark Johnson
 
Posts: n/a

Default Re: MV Keys (was: Key attributes with list values) - 02-26-2006 , 09:47 PM



"JOG" <jog (AT) cs (DOT) nott.ac.uk> wrote:

Quote:
Marshall Spight wrote:
David Cressey wrote:
"mAsterdam" <mAsterdam (AT) vrijdag (DOT) org> wrote
I've always maintained that any question about whether a collection

is ordered or not (such as a collection of pizza toppings) is a
question of domain modelling. The question of whether
onion, mushroom = mushroom, onion is exactly the question
of whether this particular collection is considered ordered
in this particular domain. To answer that, we need a
domain expert.

Yes! This point is crucial and why (dawn one should desperately
avoid the conceptual squashing of sets, multisets, orderings, peruvian
monkey fish, etc., into a single catchall "list" construct.
Because:

Quote:
its about allowing the system to be capable of maintaining
integrity and making formally correct decisions. As far as I can see,
the domain expert that Marshall specifies above can and *should be* the
system itself, as defined to it at design time when the domain was
specified.
Look at it the one way, first. If mushroom, onion needed to be
ordered, if they preferred to spread the onion over the mushroom as a
preferred practice, if one had to precede the other or else the
entity, this event, would simply be wrong, then obviously that order
must be accounted. But that's to state the obvious. It's perhaps a
contentious point, and this may be which follows. The concern was
whether or not this ought to be so constrained, whether or not it was
important to record the fact that onion followed mushroom, or if it
really didn't matter at all (which fact might also need to be stored,
rather than some other or general default). Once you decide, if you
have multiple attributes, uniquely named by precedence and role,
that's one thing. If you make these dependent in a separate table on
some named pizza recipe, then the sort would matter, as well, if you
decided that the order could not be ignored. And so on. That would
depend on the specific scheme that you use.


Reply With Quote
  #54  
Old   
JOG
 
Posts: n/a

Default Re: MV Keys (was: Key attributes with list values) - 02-26-2006 , 09:56 PM



dawn wrote:
Quote:
as defined to it at design time when the domain was
specified.

And redesigned in subsequent projects as requirements change. So, yes,
I agree with you in theory but I'm hedging related to practice.
And there you'll continue to have the advantage over me. Theory and a
sparkling ivory tower is all I got. I tried to offload them on ebay a
while back but no takers. J.

Quote:
--dawn


Reply With Quote
  #55  
Old   
Marshall Spight
 
Posts: n/a

Default Re: MV Keys (was: Key attributes with list values) - 02-26-2006 , 10:12 PM



dawn wrote:
Quote:
Marshall Spight wrote:

I might have said it that way, but the way I would typically say it is
that the user knows what it means. From my perspective this is
somewhat like the fact that the user knows what any of the data values
mean, whether the value is a list or not, although there are times when
a developer needs to know this too. There are a few times when working
on tools for the environment when I wished the user told the system
whether they cared about the ordering or not, but it is not a
significant problem.
I agree that the magnitude of the problem probably isn't huge.
But I can't help but wonder whether this is one of those
problems when, once it's solved, even those people who
were saying it wasn't a big deal will decided they could
never go back.

As far as I know, there has never been a general purpose
language with full support for the relational algebra. Once
someone has that, what might their life be like?


Quote:
Lists are just fantastically easy to implement and fantastically
easy to use,

You rock, Marshall!
Yay me! :-)


Quote:
and so they get used for things whether it makes
sense or not.

Programmers, in general, tend to use what works.
And for the most part, what else are they going to use?
Can you think of a general purpose language that has
support for relations? Can you think of a general purpose
language that *doesn't* have support for lists or arrays
or some kind of native ordered collection?

There are a few languages floating around with some
higher level collections. Python, Perl, Icon. They might
have bit sets or char sets, or they might have maps.
But once you have grokked relations, the idea of going
back to even those collections is stultifying.


Quote:
Further, it can
leak into the semantic level. Is this equation correct?
[a, b] != [b, a]. If you are using an ordered collection
to represent unordered data, you'll get the wrong answer.

Yes, that would be the type of activity where a programmer would need
to know the ordering requirements related to this particular list. The
programs then document that fact with any such equality tests.
Right, and this is probably not very hard. But it would be even less
hard if the system just did it for you.


Quote:
[I've
heard that there are practitioners who refer to lists where the
ordering is meaningful as "ordered lists" but that it bugs the crap out
of those with more ivory tower leanings who insist that all lists are
ordered ;-) ]
I can't tell you how thrilled I am to be called "ivory tower." I have
only the lousy bachelor's degree, and I work with Ph.Ds all the
time. Curse them and their knowing-a-lot-more-than-me brains!
Ha!


Quote:
I love it! May I substitute relation instead? Then it reads
"It's not that relations are difficult. It's just that lists are
easier than they have any right to be."
Yeah, well, doesn't that sound just about exactly right?

But again, once you grok relations. Once you've done
a five way hub-and-spoke join with two aggregates,
a case statement, and a rollup, you'll never go back.
In terms of bang-for-the-buck, nothing can compete
with relational operators. Natural Join is a natural
high baby.


Marshall



Reply With Quote
  #56  
Old   
JOG
 
Posts: n/a

Default Re: Key attributes with list values was Re: What are the differences ...KEY - 02-26-2006 , 10:18 PM



Brian Selzer wrote:
[snip]
Quote:
Marshall Spight wrote:
If you want a system that supports identity, you don't want to
be using set theory. There are plenty to choose from, and
they are well-supported and popular!
When I have arbitrary sets of numbers say and I want to use those sets
in some form of manipulation I can, of course, quite happily state them
mathematically something of the nature:

x = {1, 3, 8}, y = {2, 4, 7}, z = {x, y}, etc.

This is simple assignment, and gives my sets a label, or identity if
you will, so that I may go ahead and use these descriptions in future
manipulations without referring to the sets extensionally.

Surely this is identity (an artifice of course, but valuable here
nonetheless) and set theory working in perfect harmony at the heart of
mathematics?

Now, this methodology clearly violates the information
principle-centric view of using attributes only to refer to things. Yet
it is exactly the sort of thing I want to do with the data I work with
(genetic and other bioinformatics data), in spite of the cognitive
dissonance it seems to be causing me (yes,trying to reconcile what
currently seem to be equally arguable but opposing standpoints is
hurting my head ).

Perhaps there is an obvious hole in this logic, which I'm currently
missing due to some sort of antiprocess on my part.



Reply With Quote
  #57  
Old   
Marshall Spight
 
Posts: n/a

Default Re: MV Keys (was: Key attributes with list values) - 02-26-2006 , 10:30 PM



JOG wrote:
Quote:
Yes! This point is crucial and why (dawn one should desperately
avoid the conceptual squashing of sets, multisets, orderings, peruvian
monkey fish, etc., into a single catchall "list" construct.
I think that sets and multisets can both be handled well with
relations, as can orderings if necessary. But I long for
the day when mathematicians will develop a unified model
that will handle both lists and peruvian monkey fish.

Tasty, tasty peruvian monkey fish. Mmmmmm.


Marshall



Reply With Quote
  #58  
Old   
Marshall Spight
 
Posts: n/a

Default Re: Key attributes with list values was Re: What are the differences ...KEY - 02-26-2006 , 10:46 PM



JOG wrote:
Quote:
Marshall Spight wrote:
If you want a system that supports identity, you don't want to
be using set theory. There are plenty to choose from, and
they are well-supported and popular!

When I have arbitrary sets of numbers say and I want to use those sets
in some form of manipulation I can, of course, quite happily state them
mathematically something of the nature:

x = {1, 3, 8}, y = {2, 4, 7}, z = {x, y}, etc.

This is simple assignment, and gives my sets a label, or identity if
you will, so that I may go ahead and use these descriptions in future
manipulations without referring to the sets extensionally.
If all you're doing when you say "x = {1, 3, 8}" is declaring
x as an alias for the set, then x has no identity; it is just a
name for the extensional value. This is no different than
if you said "pi = 3.14159". I would call x a "constant",
although it is common parlance to call it a variable,
even if it cannot in any way vary. :-( The = sign would
not properly be called assignement; rather, it would
be called declaration.

If, on the other hand, x is a variable, and supports destructive
update operators, of whatever kind (reassignment, insert,
delete, etc.) then x indeed has identity.


Quote:
Surely this is identity (an artifice of course, but valuable here
nonetheless) and set theory working in perfect harmony at the heart of
mathematics?
Certainly. Note that the relational algebra has no destructive
update. Insert, delete, etc., are not algebraic operators
but imperative ones. The imperative operators can exist
side-by-side in harmony with the algebraic ones, just like
we can embed the algebra of the integers inside an
imperative language.

However it has occasionally been claimed that individual
rows in a relation have identity. That is, a relation variable
is a set of other variables. This is OOP; it is not relational.
Not that there's anything wrong with that. :-)


Quote:
Now, this methodology clearly violates the information
principle-centric view of using attributes only to refer to things. Yet
it is exactly the sort of thing I want to do with the data I work with
(genetic and other bioinformatics data), in spite of the cognitive
dissonance it seems to be causing me (yes,trying to reconcile what
currently seem to be equally arguable but opposing standpoints is
hurting my head ).
HTH


Marshall



Reply With Quote
  #59  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Key attributes with list values was Re: What are the differences ...KEY - 02-26-2006 , 11:01 PM




"Marshall Spight" <marshall.spight (AT) gmail (DOT) com> wrote

Quote:
Brian Selzer wrote:
You asked for an example, so here goes.

Consider the following set of propositions:

Jane Harper is married.
Jane Smith is single.

And a constraint that states that single people cannot become divorced.

Your example is quite handwavey. You haven't specified what
the attributes are. Is name a single attribute, or are first and
last separate? What is the key? What is the constraint
exactly?


I really didn't think I needed to state the obvious. The key is the name of
a person. For the purpose of this discussion it doesn't matter whether it's
modeled as a single attribute or two. Only the person's name and marital
status belong to the universe of discourse. Here's an attempt at precision
on the constraint: no update to the database shall be permitted that causes
the marital status of a person to change from single to divorced.

Quote:
It is impossible for you to know because that
information was not provided.

This is a general limitation on all software, that it can
only operate on information that it has been provided.

Nice dodge. Am I then to assume that you acknowledge the point?

Quote:
Brian Selzer wrote:
"Marshall Spight" <marshall.spight (AT) gmail (DOT) com> wrote in message

I'm not sure we're using the terms in the same way, though.
Do you speak Java?

Integer i = new Integer(1);
Integer j = new Integer(1);
System.out.println(i==j); // tests for identity
System.out.println(i.equals(j)); // tests for equality

Is that how you're using the terms?

In Java, == on a reference type tests for reference equality,
which is to say identity. If there were no reference types,
as in Prolog or SQL or whatever, then there is no identity.

That's the point: a non-1NF attribute is not scalar, hence the ambiguity.

I observe you did not answer my question, but instead introduced
new issues. I also observe that your post reversed the attributions
between my comments and yours, which I have repaired.
My newsreader is Outlook Express. I wasn't attempting to reverse
attributions. Is that how it's coming out on your reader? It isn't on
mine.

Quote:
In any event, the above Java code illustrates equality and
identity as I use the terms. Did you understand the example
code?

Yes, I did. That's not how I'm using the term identity. I'm not referring
to pointer arithmetic, but rather what makes something unique within a given
context. In the context of a roll of quarters, each quarter has identity
with respect to all other quarters in the same roll, perhaps determined by
the distance from one end of the roll. In the context of a single database
state, each proposition has identity with respect to all other propositions
in that database state. For a relational database, the name of the
containing relation combined with a value for one of its candidate keys is
sufficient to represent that identity, but only for a single database state.
If the database definition includes a temporal constraint, then it must be
possible to correlate values from the current database state with values in
the proposed database state. This means that the identity of a proposition
must remain constant during an update, which is not possible if all
candidate keys can change.

Quote:
Members of a set don't have identity.

Yes they do. Is a roll of quarters worth 25 cents? No, and to elucidate
upon my previous point, the attributes that would uniquely identify each
individual quarter may not be relevant within the universe of discourse,
but
that doesn't change the fact that there are still 40 quarters.

Again, it is a general limitation of software that it can only operate
on the information it has.


If you want a system that supports identity, you don't want to
be using set theory. There are plenty to choose from, and
they are well-supported and popular!

Yes, I do want to be using set theory. The recognition of identity does
not
alter the sound theoretical foundation that the Relational Model
provides.
It strengthens it, or better yet, completes it.

We still haven't really established what you mean by "identity",
although you've said it's not the same thing as keys.


Marshall




Reply With Quote
  #60  
Old   
David Cressey
 
Posts: n/a

Default Re: MV Keys (was: Key attributes with list values) - 02-27-2006 , 05:44 AM




"Marshall Spight" <marshall.spight (AT) gmail (DOT) com> wrote

Quote:
JOG wrote:

Yes! This point is crucial and why (dawn one should desperately
avoid the conceptual squashing of sets, multisets, orderings, peruvian
monkey fish, etc., into a single catchall "list" construct.

I think that sets and multisets can both be handled well with
relations, as can orderings if necessary. But I long for
the day when mathematicians will develop a unified model
that will handle both lists and peruvian monkey fish.

Tasty, tasty peruvian monkey fish. Mmmmmm.


Marshall




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.