| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Functions and Relations
NENASHI, Tegiri wrote:
> "Aloha Kakuikanu" <aloha.kakuikanu_at_yahoo.com> wrote in
> news:1163794792.364269.246040_at_m7g2000cwm.googlegroups.com:
> > 1. Function invocation is a join:
> >
> > f(x) /\ x=1
> >
> > 2. Function composition is a join:
> >
> > g(f(x)) <==> g(z,y) /\ f(y,x)
>
> I am not in agreement: the function composition takes two binary relations
> and gives one binary relation, it does not the arity. g o f = Z <-g- Y <-
> f- X loses the information about Y. The natural join increases the arity
> and onserves Y.
Yes, in both cases it is a join, followed by projection. Also, not that if you have 2 functions
f: x->y
g: x->y
which are represented as relations F and G, then you have to do renaming before joining:
g o f:
({[(F /\ `y=z`) \/ `xz`] /\ `x=y` \/ `yz`} /\ G) \/ `xz`
Therefore, the correct thesis would be that function composition can be represented via basic relational operators; they are not exactly the same. This also explains why composition is not commutative, while join is commutative. But then, both composition and join are associative. Is it merely a coincidence?
> It is interesting like a theory but please show with an example when the
> function-like-relation is more practical. Is it that you want to utilize
> the function with the relational algebra operators ?
SQL optimization. Consider
select sal+100 from emp
what exactly is "sal+100" and how to show it on the explain plan? If it is merely an expression, then what about corellated scalar subquery:
select (select dname from dept d where d.deptno=e.deptno) from emp e
How does one show scalar subquery on the expalin plan? How about functon call
select raise(sal) from emp Received on Mon Nov 20 2006 - 13:46:00 CST
![]() |
![]() |