Another Friday Question

Another Friday Question

 

  

Hi Ed,

Here is a Friday question for you. This time it is in SQL (I am just a
developer, so pardon me for the blasphemy!).

Consider a table TEST having a single column called num which is of
dataype
NUMBER. Assuming that the table has 5 rows, and all have positive
integers
in the num column. There are no NULLs.

If one has to find the total of the num column for all the rows of the
table, it is
quite simple. Use the aggregate function SUM().

But, if one has to find the product of the num column, how would you do
it ?
(It has to be done in a SQL query, and NOT a PL/SQL script or procedure)

Regards,
Jayadas

Here is the script to create the test environment :-
/* DROP TABLE TEST; */

CREATE TABLE TEST
(
num NUMBER NOT NULL
);

INSERT INTO TEST VALUES (1);
INSERT INTO TEST VALUES (2);
INSERT INTO TEST VALUES (3);
INSERT INTO TEST VALUES (4);
INSERT INTO TEST VALUES (5);

COMMIT;


Oracle LazyDBA home page