Re: What is a tuple? - Mailing list pgsql-general

From Curt Sampson
Subject Re: What is a tuple?
Date
Msg-id Pine.NEB.4.43.0206272251420.6613-100000@angelic.cynic.net
Whole thread Raw
In response to Re: What is a tuple?  (ktt <kestutis98@yahoo.com>)
List 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@cynic.net>   +81 90 7737 2974   http://www.netbsd.org
    Don't you know, in this new Dark Age, we're all light.  --XTC




pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Error message : Server sent data ("D" message) ....
Next
From: nconway@klamath.dyndns.org (Neil Conway)
Date:
Subject: Re: user defined functions