SQL QUESTION Implement and test an aggregate that calculates the product of all
ID: 3585254 • Letter: S
Question
SQL QUESTION
Implement and test an aggregate that calculates the product of all the numbers in a table.
Include the correct DROP statements above your aggregate, functions, and types (if you need any).
For example if your aggregate is called user_prod and you are given the following table (called numbers):
Thing numeric
4
3
8
Then the query, SELECT user_prod(thing) FROM numbers; will return the table:
user_prod numeric
96
I am getting syntax error any help please i dont know what wrong i am doing .....??
Explanation / Answer
Hi,
Use the below query that will give you the product of value sof thing column in table numbers
SQL> select exp(sum(ln(thing))) from numbers;
EXP(SUM(LN(THING)))
-------------------
96
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.