Re: Extending my question. Was: The relational model and relational algebra - why did SQL become the industry standard?
Date: 21 Feb 2003 15:52:04 -0800
Message-ID: <e4330f45.0302211552.5693b90_at_posting.google.com>
"Mikito Harakiri" <mikharakiri_at_ywho.com> wrote in message news:<D0z4a.21$h_3.106_at_news.oracle.com>...
> Is he treating each new tuple
> inserted into a relation individually; unrelated to other tuples inserted
> (in the same transaction)?
He said "relational operations are always set-at-a-time; a set containing a simple row is merely a special case"
>
> Returning to the example
>
> select id, 'VOICE' type, voice phone
> from contact
> union
> select id, 'FAX' type, fax phone
> from contact
>
> we can easily see that both assumtions aren't correct:
>
> 1. Sucessively applied operations can't be considered independently of each
> other. In the above example union can't be considered independently of the
> antiprojection (BTW, what is the correct term for adding a pseudocloumn?).
It is an attribute. The operation of adding a new attribute to a relation is called extension.
> 2. Two tuples inserted together into a derived relation correspond to a
> single tuple insertion in the base relation. The approach based upon "single
> tuple" translation is flawed.
An example (apologies about the possible typos):
var phones real relation
{ id integer, voice char default '', fax char default '' } key { id };
var a virtual (extend (phones {id, voice}) add 'VOICE' as type) rename voice as phone key { id };
var b virtual (extend (phones {id, fax}) add 'FAX' as type) rename fax as phone key { id };
var c virtual a union b key { id, type };
insert into c relation {
tuple { id 1, type 'VOICE', phone '34-9-6969696' }, tuple { id 1, type 'FAX', phone '34-9-9696969' } };
Relvar c predicate is: (P(a) or P(b))
It is my personal interpretation of the approach:
- POSSIBLE DUMB IDEA WARNING ON ----- O:)
And it satisfies P(a), thus it could be provisionally translated to:
(phones with id 1 has a voice number: '34-9-6969696')
insert into phones relation {
tuple { id 1, voice '34-9-6969696' } };
The second tuple means: (c with id 1 has a 'FAX' number: '34-9-9696969')
And it satisfies P(b), thus it could be provisionally translated to:
(phones with id 1 has a fax number: '34-9-9696969')
insert into phones relation {
tuple { id 1, fax '34-9-9696969' }
};
And combining both logical propositions before assigning would result in:
(phones with id 1 has a voice number: '34-9-6969696')
AND
(phones with id 1 has a fax number: '34-9-9696969')
(phones with id 1 has a voice number: '34-9-6969696' and a fax number: '34-9-9696969')
Final result:
insert into phones relation {
tuple { id 1, voice '34-9-6969696', fax '34-9-9696969' } };
- POSSIBLE DUMB IDEA WARNING OFF ----- O:)
relation {
tuple { id 1, voice '34-9-6969696', fax '' }, tuple { id 1, voice '', fax '34-9-9696969' } };
is a logical contradiction and it must fail.
And here:
insert into phones relation {
tuple { id 1, voice '34-9-6969696' } };
insert into phones relation {
tuple { id 1, fax '34-9-9696969' }
};
the second insert must fail because they are two different operations.
Regards,
Alfredo
Received on Sat Feb 22 2003 - 00:52:04 CET