Re: oracle query

From: Mark D Powell <markp7832_at_my-deja.com>
Date: Tue, 06 Feb 2001 14:40:56 GMT
Message-ID: <95p2dm$4fp$1_at_nnrp1.deja.com>


In article <95movl$5hq$1_at_nnrp1.deja.com>,   Vadim Tropashko <vadimtro_at_yahoo.com> wrote:
> In article <95fl8f$21c$1_at_nnrp1.deja.com>,
> Aloha Kakuikanu <alohakaku_at_yahoo.com> wrote:
> > In article <95fcin$qgb$1_at_nnrp1.deja.com>,
 

> > BTW, try to query Greatest Common Divisor -- I've read that
> > SQL is incomplete, so you cannot calculate anything your way.
>
> select max(c.gcd) from
> (select rownum as x from PHONES where rownum < 15) a,
> (select rownum as y from PHONES where rownum < 15) b,
> (select rownum as gcd from PHONES where rownum < 15) c
> where gcd*x=6
> and gcd*y=9
>
> (Those limitations are because the RDBMS I use comes with very
> inefficient plan)
>
> You probably meant relational algebra, not SQL
>
Note that x is a character string so it must be enclosed in single quotes in Oracle. To select a power or square root in Oracle you would reference the function while a numeric constant could be retrieved by value:

UT1> l
  1 select 'x' as COL1,

  2          sqrt(99) as COL2,
  3         22

  4* from dual

UT1> /

C COL2 22
- ---------- ----------
x 9.94987437 22

I hope this is of some help.

--
Mark D. Powell  -- The only advice that counts is the advice that
 you follow so follow your own advice --


Sent via Deja.com
http://www.deja.com/
Received on Tue Feb 06 2001 - 15:40:56 CET

Original text of this message