

Sudoku solver in SQL - makmanalp
http://www.celko.com/sudoku.txt

======
Avshalom
Sudoku Solver in Apt (note: this is pretty old you've probably all seen it I
just felt it's cool and relevant)

[http://algebraicthunk.net/~dburrows/blog/entry/package-
manag...](http://algebraicthunk.net/~dburrows/blog/entry/package-management-
sudoku/)

------
jcw
This is really cool.

I thought one of the design decisions of SQL was that it would NOT be Turing
complete, so hacks like this could not exist. It's funny that the nature of a
database makes things like this possible. Can a turing machine be made only
using SQL queries? Could a higher-level language compile to it?

~~~
makmanalp
In my humble opinion, there are so many proprietary and / or nonstandard
extensions to SQL that it's turned into a right mess. I think that the
language itself is a bit kludgey and it'd be much easier if it'd just
correspond to relational algebra directly. (Eg if you do a select * from foo
where x = y, you're actually doing two operations, a select and a filter, and
the natural language like syntax of the language makes it very ambiguous and
confusing when you're dealing with complicated structures like nested joins
and such)

------
vsingh
Nice. It's not nearly as awesome, but here's my Sudoku solver in Clojure:

[http://github.com/vishsingh/lisp-
toronto/blob/80ea008e80976d...](http://github.com/vishsingh/lisp-
toronto/blob/80ea008e80976d3ec08b9005ace7658ec5278472/meetings/04-2009/sudoku.clj)

------
kevindication
Of course this is just a silly hack so I can't be too hard on style here, but
it would have been worth it to make a table for the input/output. An argument
list of 81 values is painful to see.

~~~
makmanalp
I've been reading about that too:

<http://www.celko.com/puzzles.htm> (first part) vs
[http://sqlblog.com/blogs/hugo_kornelis/archive/2007/10/04/ho...](http://sqlblog.com/blogs/hugo_kornelis/archive/2007/10/04/how-
not-to-pass-a-lot-of-parameters.aspx) (Celko replies in the comments)

------
lamby
My Postscript one.. [http://chris-lamb.co.uk/2007/06/10/sudoku-solver-in-
postscri...](http://chris-lamb.co.uk/2007/06/10/sudoku-solver-in-postscript/)

