O’Reilly Releases “SQL Hacks”

“SQL Hacks” is primarily aimed at the working programmer, but author Andrew Cumming assures non-programmers that they’ll find the book useful as well. “If you’re confident using a drag-and-drop query builder to get the data you need on an ad-hoc basis, then maybe you should think about taking your skills to the next level. You can use a query builder for the simple stuff–it’s ideal–but if you’re asking complex questions of your database then sooner or later you need to get your hands dirty and write some SQL.”

The book is also for those programmers who hate SQL, the kind who reach for a loop or hash table to do anything but the simplest filtering commands. “If they took just a little time to learn a handful of tricks, they could improve their code and their productivity immensely,” says Cumming.

Equally applicable for users running Access, MySQL, SQL Server, Oracle, or PostgreSQL, “SQL Hacks” shows how to:

-Wrangle data in the most efficient way possible -Aggregate and organize data for meaningful and accurate reporting -Make the most of subqueries, joins, and unions -Stay on top of the performance of your queries and the server that runs them -Avoid common SQL security pitfalls, including the dreaded SQL injection attack

“Just a tiny bit more SQL can make a huge difference in terms of efficiency and maintainability,” Cumming reminds his readers. “If you have a choice between implementing a complicated calculation in the program or in the database, many programmers will do it in the program because that’s the language they’re more comfortable with. But if you do it in the database, the chances are it will run faster. Not only that, it will live longer, too. When the next version of your application comes out, the application code may well be digital dust–but the data, the database, and your queries and views are likely to survive–to be reused over and over.”

Andrew Cumming is the Zoo Keeper at http://sqlzoo.net. He keeps a collection of tame SQL engines and presents these to the public. He cares for these beasts, protecting them from the abuse inflicted by SQL learners, and protecting SQL learners from the injuries that the wild engines can inflict. But mostly he shovels manure out of the cages and hoses them down every now and then. Andrew also teaches at Napier University in Edinburgh, Scotland.

Dr. Gordon Russell is a Computing lecturer in Napier University, Scotland.
He teaches databases, Linux, and networking. He also builds educational websites, concentrating on technology-driven online learning environments.

These include http://db.grussell.org, whose claim-to-fame is its automatic checking of SQL assessments, and http://linuxzoo.net, which offers online users root free access to Linux servers. But without database technology to support these sites, even he would be lost.

Don't miss