From: | Curt Sampson <cjs(at)cynic(dot)net> |
---|---|
To: | ktt <kestutis98(at)yahoo(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: What is a tuple? |
Date: | 2002-06-27 13:59:25 |
Message-ID: | Pine.NEB.4.43.0206272251420.6613-100000@angelic.cynic.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Well, maybe just to keep things fun, I'll confuse the heck out of
all you guys.
To be pedantic, "relation" and "tuple" are mathmatical terms used
in relational algebra; "table" and "row" are references to entities
in physical storage.
A relation cannot contain duplicate tuples, but a table can contain
duplicate rows. So let's look at the following:
key | value
--------+---------------------
1 | one
2 | two
2 | two
This can be a table, but not a relation. The relation wouldn't have
that last row in it.
But in fact, it gets more interesting. Tables don't actually
correspond to relations; they correspond to _relvars_, or variables
that hold relations. Given the following table "foo":
SELECT * FROM foo
key | value
--------+---------------------
1 | one
2 | two
DELETE FROM foo WHERE key = 2
SELECT * FROM foo
key | value
--------+---------------------
1 | one
The two relations you see above are obviously not equal. They're
two different relations. When you deleted that row/tuple, you
effectively assigned a new relation to the relvar "foo".
There's more like this, but it can be most effectively appreciated by
reading C. J. Date's book _An Introduction to Database Systems_.
cjs
--
Curt Sampson <cjs(at)cynic(dot)net> +81 90 7737 2974 http://www.netbsd.org
Don't you know, in this new Dark Age, we're all light. --XTC
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2002-06-27 14:00:09 | Re: user defined functions |
Previous Message | Tom Lane | 2002-06-27 13:51:04 | Re: Error message : Server sent data ("D" message) .... |