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

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL Fun Challenge #2

Re: SQL Fun Challenge #2

From: Noel <tbal_at_go2.pl>
Date: Thu, 4 Mar 2004 10:28:30 -0000
Message-ID: <c26ske$881$1@inews.gazeta.pl>


> The solution is somhere here...
> I skip creating tables...

There was syntax error, sorry ...
This is runnable sql:

--
 SELECT X Youngest,Y MiddleAge, Z Oldest
  FROM
      (
      SELECT ROWNUM X
        FROM ALL_TABLES
       WHERE ROWNUM < 20
      ),
      (
      SELECT ROWNUM Y
        FROM ALL_TABLES
       WHERE ROWNUM < 20
      ),
      (
     SELECT ROWNUM Z
       FROM ALL_TABLES
      WHERE ROWNUM < 20
      )
     WHERE X * Y * Z = 36
       AND X<=Y
       AND Y<Z
       AND X<Z
       AND (X+Y+Z) =
           (
           SELECT  X + Y + Z
             FROM
               (
            SELECT ROWNUM X
              FROM ALL_TABLES
             WHERE ROWNUM < 20
               ),
               (
           SELECT ROWNUM Y
             FROM ALL_TABLES
            WHERE ROWNUM < 20
              ),
              (
           SELECT ROWNUM Z
             FROM ALL_TABLES
            WHERE ROWNUM < 20
              )
         WHERE X * Y * Z = 36
           AND X<=Y
           AND Y<=Z
        GROUP BY X+Y+Z
        HAVING COUNT(*) > 1
        );

--
Noel
Received on Thu Mar 04 2004 - 04:28:30 CST

Original text of this message

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