O’Reilly news

SQL Cookbook: Getting More from SQL with Expert Techniques and Features

January 4, 2006

Sebastopol, CA--SQL is one of the topics that many programmers learn a little about, but just enough to eke by while building that web application or performing a task in the office. It's a deceptively easy language to learn. Database developers can begin with the simple statement: SELECT FROM

WHERE and accomplish quite a bit. Many, in fact, don't go far beyond that. Yet, there is so much more that the language can do. In SQL Cookbook (O'Reilly, US $ 39.95), experienced SQL developer Anthony Molinaro shows off his favorite SQL techniques and features.

Molinaro has provided an exceptional resource for all SQL programmers interested in getting the best out of the language. Molinaro says, "Databases are the foundation of IT So, knowing how to retrieve information is of utmost importance. Additionally, poorly performing SQL is typically at the root of database performance problems; knowing how to write efficient queries enables fast data access, which is crucial today. People want their information and they want it immediately. Knowing new features such as window functions provides better performance in many cases. Moreover, window functions allow you to do in SQL what used to be done in application code."

The book contains more than 200 recipes for solving SQL problems. Molinaro describes it, "Queries, queries, queries. My goal from the beginning was not so much to write a 'SQL Cookbook' as to write a 'Query Cookbook.' I've aimed to create a book of queries ranging from the relatively easy to the difficult in hopes the reader would grasp the techniques behind those queries and use them to solve their own business problems."

SQL Cookbook covers SQL Server, PostgreSQL, Oracle, MySQL, and DB2, and includes recipes on the following important topics:

  • Window functions
  • Pivoting rows into columns
  • Reverse-pivoting columns into rows
  • Creating histograms
  • Summarizing data into buckets
  • Generating running totals and subtotals
  • Walking a string
  • Vendor specific features such as Server's PIVOT, Oracle's MODEL clause, and PostgreSQL's GENERATE_SERIES
  • Molinaro is known as the go-to guy among his clients when it comes to difficult SQL query problems. He's thoroughly well versed in the subject, understands relational theory, and has nine years hands-on experience solving tough SQL problems. He has given SQL users at all levels the ideal book, written in the popular problem/solution/discussion format of O'Reilly's Cookbook series.

    If you know the rudiments of the SQL query language, yet aren't taking full advantage of it, the SQL Cookbook can show you how to get more out SQL before you resort to other tools or languages.

    As Olivier Pomel, director of technology for Wireless Generation, Inc. says, "Once you find out how many lines of convoluted application code you can save when leveraging SQL, this book won't leave your desk."

    Additional Resources:

    SQL Cookbook
    Anthony Molinaro
    ISBN: 0-596-00976-3, 595 pages, $39.95 US
    order@oreilly.com
    1-800-998-9938; 1-707-827-7000

    About O’Reilly

    O’Reilly Media spreads the knowledge of innovators through its books, online services, magazines, and conferences. Since 1978, O’Reilly Media has been a chronicler and catalyst of cutting-edge development, homing in on the technology trends that really matter and spurring their adoption by amplifying “faint signals” from the alpha geeks who are creating the future. An active participant in the technology community, the company has a long history of advocacy, meme-making, and evangelism.

    Email a link to this press release