SQL Aggregate Product

hk7math

hk7math

Posted on December 24, 2020

SQL Aggregate Product

Been left on CodeSignal for a while because I'm lately rushing for a full stack course~ Today's task appears to be simple but the solution is not equally simple. Indeed, I learnt my lesson. In brief, we are required to do an aggregated product in SQL.

It turns out that such fundamental function is not supported in SQL. You may wanna ponder on it a bit. The hint is: simple "useless" math XD

When I look through the top 10 solutions, ALL OF THEM use exactly the same skill:

Here is this famous workaround
SELECT EXP( SUM( LN( field ) ) ) | 0
FROM table
Enter fullscreen mode Exit fullscreen mode

Please suggest below if you come up with some other ways X)

💖 💪 🙅 🚩
hk7math
hk7math

Posted on December 24, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

SQL Aggregate Product
todayilearned SQL Aggregate Product

December 24, 2020