Re: sudoku in an sql statement

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org, Merlin Moncure <mmoncure(at)gmail(dot)com>
Subject: Re: sudoku in an sql statement
Date: 2009-11-01 15:19:47
Message-ID: 6273.1257088787@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thomas Kellerer <spam_eater(at)gmx(dot)net> writes:
> Merlin Moncure wrote on 31.10.2009 14:32:
>> an oracle guy wrote an sql statement that solves a sudoku
>> puzzle...using an oracle specific feature. Still, it's pretty neat,
>> and an absolute gem of lateral thinking.
>>
>> http://technology.amis.nl/blog/6404/oracle-rdbms-11gr2-solving-a-sudoku-using-recursive-subquery-factoring

> There is also a DB2 version:
> http://forums.devshed.com/db2-development-114/absolute-sudoku-solver-641065.html

The DB2 version looks amazingly brute-force :-(

I think the Oracle guy's version could easily be adapted to PG 8.4 ---
those little rownum subqueries seem to be just a substitute for not
having generate_series(1,9), and everything else is just string-pushing.
Don't have time to try it myself right now, though.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hervé Piedvache 2009-11-01 15:56:15 Translate function and strange results ...
Previous Message Thomas Kellerer 2009-11-01 14:40:35 Re: Store images on database ou in external files?