Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL Fun Challenge #2
> Create a table, load it with data, and write a single SQL statement to
> produce the data set required to deduce the answer ... then deduce away!
The solution is somhere here...
I skip creating tables...
-- 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 ); -- NoelReceived on Thu Mar 04 2004 - 04:24:15 CST