Re: RM and definition of relations/tuples

From: David Cressey <david.cressey_at_earthlink.net>
Date: Fri, 25 Nov 2005 14:27:49 GMT
Message-ID: <FbFhf.3404$aA2.2888_at_newsread2.news.atl.earthlink.net>


"Martin Zapf" <Martin_Zapf_at_gmx.net> wrote in message news:dm1qq0$utl$1_at_online.de...
> I have a question to the Relational Model and the definition of
> relations and tuples.
>
>
> I learned the following definitions:
>
> A relation schema R is a set of Attributes R={A_1,A_2,...,A_n}
> Each Attribute A has a domain dom(A)
>
> Here comes the problem, there are two definitions for relations/tuples
>
> 1. defintion:
>
> A relation r for schema R is a mathematical relation (cartesian
> product) over the
> domains from the attributes of R.
> So r:=dom(A_1)xdom(A_2)x...xdom(A_n)
> A tuple is an element of r.
>
> 2. definition
>
> A relation r for schem R is a set of tuples.
> A tuple t is a function
> t: R -> Union (dom(A_1),dom(A_2),...,dom(A_1))
> t maps each Attribute of R to an value of its domain.
> So a relation is a set of functions, which are called tuples.
>
>
> I noticed, that the difference between this two definition is that
> definition 1 forces a certain order for the Attributes and the values
> for them in the tuples.
> The 2. definition doesnt need any order for the attributes.
>
>
> Im quite confussed, is there a "better" definition or should you always
> use both?

Most of the answers to your OP have dealt with theory. I'd rather discuss it from a practical view.

In practice most of the self styled relational DBMS products have used SQL as the interface. There are several places where SQL uses positional dependant syntax. Here's one:

INSERT INTO T (A, B, D, C)
VALUES (1, 2, 3, 4); This will put the value 4 into C and the value 3 into D. The values are matched to the named columns by position.

Let's try another example:

INSERT INTO T
VALUES (1, 2, 3, 4); Now the values are matched up with the columns of T according to some implicit order... usually the order the columns were mentioned in the CREATE TABLE statement.

So... if I have this:

CREATE TABLE T (A INTEGER, B INTEGER, C INTEGER, D INTEGER); INSERT INTO T VALUES (1, 2, 3, 4); or

CREATE TABLE T (A INTEGER, B INTEGER, D INTEGER, C INTEGER); INSERT INTO T VALUES (1, 2, 3, 4); I get logically different results.

From a certain point of view (which I share) this is an unfortunate outcome of the way the language was developed. Received on Fri Nov 25 2005 - 15:27:49 CET

Original text of this message