Re: What is a tuple?

Поиск
Список
Период
Сортировка
От Curt Sampson
Тема Re: What is a tuple?
Дата
Msg-id Pine.NEB.4.43.0206272251420.6613-100000@angelic.cynic.net
обсуждение исходный текст
Ответ на Re: What is a tuple?  (ktt <kestutis98@yahoo.com>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Error message : Server sent data ("D" message) ....
Следующее
От: nconway@klamath.dyndns.org (Neil Conway)
Дата:
Сообщение: Re: user defined functions