Match to the PragProg code...

There are some differences.  I'm using PostgreSQL, and I also fixed some errors (that I may have created, not sure).