Re: RM and definition of relations/tuples



Martin Zapf wrote:

> 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?

The definitions for RM have confused me for a while too. In RM
statements are of course encoded as a "tuple", which I essentially
read as a finite partial map (which is of course a constrained form of
mathematical relation), such as:
R = { (teacher, t), (book, b), (course,c) }

Order clearly doesn't matter here, as we have a set of pairs and each
row of an RDBMS table represents a different function R. Hence the RM
table, which a set of these tuples, is actually a set of mathematical
relations - to refer to that table as a relation itself therefore seems
odd. Definitions I've read seem to address this in a slight shift or
expansion in the definition of a tuple or a relation (Codd's for
example seem to try to remedy this with some jiggery pokery with
relations to incorporate headers). This of course is all just
nomenclature, but I wonder if I am missing something nonetheless
(perhaps someone more knowledgable might be able to throw some light on
this). So I certainly see the RM world along the lines of your second
definition, but I find the terminology of database relations slightly
jarring in all cases.

.