Comments on: NoCOUG SQL challenge https://grey-panther.net/2009/04/nocoug-sql-challenge.html Just another WordPress site Tue, 22 Feb 2011 20:04:48 +0000 hourly 1 https://wordpress.org/?v=6.9.4 By: Iggy Fernandez https://grey-panther.net/2009/04/nocoug-sql-challenge.html#comment-72 Tue, 22 Feb 2011 20:04:48 +0000 https://grey-panther.net/?p=326#comment-72 The Second International NoCOUG SQL Challenge has been published in the February 2011 issue of the NoCOUG Journal. The Journal can be downloaded from http://bit.ly/gVNZsW. SQL commands for creating the required data are available at http://bit.ly/g58WVn.

]]>
By: Iggy Fernandez https://grey-panther.net/2009/04/nocoug-sql-challenge.html#comment-428 Tue, 07 Apr 2009 04:26:13 +0000 https://grey-panther.net/?p=326#comment-428 Oracle does not yet have recursive CTEs so in that respect, PostgreSQL is ahead of Oracle. Oracle does have “table functions” though; that is, functions that return multiple rows of data. It is believed that Oracle will introduce recursive CTEs in version 11.2–a.k.a. 11gR2–which isexpected to be announced at Oracle OpenWorld in October of this year.

PostgreSQL was not included in the NoCOUG SQL challenge in order to ease the burden on the judges but your recursive solution is excellent and easily translated into Oracle PL/SQL. Congratulations on noticing that grouping can be performed after each iteration in order to keep the calculations manageable. But PostgreSQL will probably balk when the recursion gets too deep. I believe that Oracle does not support more than 50 levels of recursion.

If you’re like to do some benchmarking, here are some results for the case of an unbiased conventionally numbered 20-sided die, each face having probability 0.05. Only the mode is shown; that is, the sum that has the highest probability.

Throws Mode Probabilitity
128 1344 0.006107973793216340000000000000
256 2688 0.004321538266140720000000000000
512 5376 0.003056689677902580000000000000
1024 10752 0.002161724362372430000000000000
2048 21504 0.001528682501663810000000000000
4096 43008 0.001080981552024420000000000000
8192 86016 0.000764383452856994000000000000

Regards,

Iggy Fernandez

]]>