DEV Community

loading...

SQL Aggregate Product

hk7math profile image hk7math ・1 min read

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)

Discussion (0)

pic
Editor guide