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: oracle query

Re: oracle query

From: Vadim Tropashko <vadimtro_at_yahoo.com>
Date: Fri, 02 Feb 2001 22:32:54 GMT
Message-ID: <95fcin$qgb$1@nnrp1.deja.com>

In article <95fbbt$pbv$1_at_nnrp1.deja.com>,   Aloha Kakuikanu <alohakaku_at_yahoo.com> wrote:
> In article <95eq8n$8o2$1_at_nnrp1.deja.com>,
> Vadim Tropashko <vadimtro_at_yahoo.com> wrote:
> > In article <95ep49$7ih$1_at_nnrp1.deja.com>,
> > Aloha Kakuikanu <alohakaku_at_yahoo.com> wrote:
> > > I queried oracle
> > >
> > > select x from dual where x*x=4
> > >
> > > but got "invalid column name".
> > >
> > Well, the correct answer you might find on oracle forum. But if you
> > still want to do it that way:
> >
> > select x from (
> > select 1 as x from dummy
> > union
> > select 2 as x from dummy
> > union
> > select 3 as x from dummy)
> > where x*x=4
> >
> Thank you for your suggestion, but I really meant something else.
> Besides, your solution doesn't work for 25!

Just take a table big enough, say, all_people, and rewrite the query:

select rownum as x from all_people
 where x*x=25

Your question is deeper than it sounds on the surface. The query above could be viewed as a formal declarative spec of what your program really wants, and query execution is just some not very efficient implementation. An exciting part comes when you discover that some RDBMS allow you to define your own indexes, so the query speed could definetely be improved. And that changes your view on what indexes really are completely. I'm not familiar with this topic in depth, however.

Sent via Deja.com
http://www.deja.com/ Received on Fri Feb 02 2001 - 16:32:54 CST

Original text of this message

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