Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Does Codd's view of a relational database differ from that ofDate&Darwin?[M.Gittens]

Re: Does Codd's view of a relational database differ from that ofDate&Darwin?[M.Gittens]

From: Alexandr Savinov <savinov_at_host.com>
Date: Tue, 21 Jun 2005 13:22:01 +0200
Message-ID: <42b7f85e$1@news.fhg.de>


Alfredo Novoa schrieb:
> On Tue, 21 Jun 2005 11:39:37 +0200, Alexandr Savinov
> <savinov_at_host.com> wrote:
>
>

>>Alfredo Novoa schrieb:
>>
>>>>>for each s in employee
>>>>>   print(getName(s), getAge(s),
>>>>>getName(getBuilding(getDepartment(s))))
>>>>
>>>>What's imperative about this?
>>>
>>>
>>>Everything!
>>
>>This example is equivalent to
>>
>>select s.name, s.age, s.department.building.name from employee s

>
>
> No, it is equivalent to:
>
> for (int index = 0; index < employee.Count; index++)
> {
> s = employee[index];
> print(getName(s), getAge(s),
> getName(getBuilding(getDepartment(s))));
> }

This is the way how you compiled that code. And I can suppose that some simple compilers will be implemented in this very way. However, again, the same can be said about SQL queries and other declarative statements, say, from Prolog. At one or another layer of the system, declarative statements are converted into loops. In purely declarative queries we never know about that and it is supposed that we never need to know it in order to get some result. But the FDM query

for each s in employee

    print(getName(s), getAge(s),
getName(getBuilding(getDepartment(s))))

also does not have any indication about order in which elements will be processed and there is no iterator in it (you add it when you manually compiled it).

> And this is what you get if you decompile that code.
>
> "for each" is only a syntactic shorthand for a "for" loop.

Yes, but when we are talking about for loop we mean that it will have an iterator. Such an iterator is not used in FDM queries.

Yet, I agree that FDM queries are still different from purely declarative queries. But this difference is rather subtle and difficult to explain. May be it is the use of print keyword or possible intermediate operations. Another question if such an approach is usefull. I consider it very attractive and rather useful. For me personally it is easier to use FDM queries than SQL queries. Although for many uses SQL queries could be more expressive.

-- 
http://conceptoriented.com
Received on Tue Jun 21 2005 - 06:22:01 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US