
Amazon Prime Free Trial
FREE Delivery is available to Prime members. To join, select "Try Amazon Prime and start saving today with FREE Delivery" below the Add to Cart button and confirm your Prime free trial.
Amazon Prime members enjoy:- Cardmembers earn 5% Back at Amazon.com with a Prime Credit Card.
- Unlimited FREE Prime delivery
- Streaming of thousands of movies and TV shows with limited ads on Prime Video.
- A Kindle book to borrow for free each month - with no due dates
- Listen to over 2 million songs and hundreds of playlists
Important: Your credit card will NOT be charged when you start your free trial or if you cancel during the trial period. If you're happy with Amazon Prime, do nothing. At the end of the free trial, your membership will automatically upgrade to a monthly membership.
Buy new:
-41% $29.56$29.56
Ships from: Amazon Sold by: Everleaf Books
Save with Used - Very Good
$9.70$9.70
Ships from: Amazon Sold by: Golden Hour Books West
Return this item for free
We offer easy, convenient returns with at least one free return option: no shipping charges. All returns must comply with our returns policy.
Learn more about free returns.- Go to your orders and start the return
- Select your preferred free shipping option
- Drop off and leave!

Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the author
OK
SQL Cookbook: Query Solutions and Techniques for Database Developers 1st Edition
Purchase options and add-ons
Let's face it, SQL is a deceptively simple language to learn, and many database developers never go far beyond the simple statement: SELECT columns FROM table WHERE conditions. But there is so much more you can do with the language. In the SQL Cookbook, experienced SQL developer Anthony Molinaro shares his favorite SQL techniques and features. You'll learn about:
- Window functions, arguably the most significant enhancement to SQL in the past decade. If you're not using these, you're missing out
- Powerful, database-specific features such as SQL Server's PIVOT and UNPIVOT operators, Oracle's MODEL clause, and PostgreSQL's very useful GENERATE_SERIES function
- Pivoting rows into columns, reverse-pivoting columns into rows, using pivoting to facilitate inter-row calculations, and double-pivoting a result set
- Bucketization, and why you should never use that term in Brooklyn.
- How to create histograms, summarize data into buckets, perform aggregations over a moving range of values, generate running-totals and subtotals, and other advanced, data warehousing techniques
- The technique of walking a string, which allows you to use SQL to parse through the characters, words, or delimited elements of a string
Written in O'Reilly's popular Problem/Solution/Discussion style, the SQL Cookbook is sure to please. Anthony's credo is: "When it comes down to it, we all go to work, we all have bills to pay, and we all want to go home at a reasonable time and enjoy what's still available of our days." The SQL Cookbook moves quickly from problem to solution, saving you time each step of the way.
- ISBN-109780596009762
- ISBN-13978-0596009762
- Edition1st
- PublisherO'Reilly Media
- Publication dateJanuary 24, 2006
- LanguageEnglish
- Dimensions7 x 1.4 x 9.19 inches
- Print length633 pages
There is a newer edition of this item:
Frequently bought together

Customers who viewed this item also viewed
From the brand

-
Sharing the knowledge of experts
O'Reilly's mission is to change the world by sharing the knowledge of innovators. For over 40 years, we've inspired companies and individuals to do new things (and do them better) by providing the skills and understanding that are necessary for success.
Our customers are hungry to build the innovations that propel the world forward. And we help them do just that.
-
Your partner in learning
-
Bestsellers
-
Software Development
-
Programming Languages
-
AI / Machine Learning
-
Data Science
-
Data, Databases and more
-
Cloud Services
-
Business
-
Finance
-
Blockchain / Cryptocurrency
-
Security
-
Cookbooks
-
Head First series
-
97 Things series
-
Lean series
Editorial Reviews
About the Author
Product details
- ASIN : 0596009763
- Publisher : O'Reilly Media; 1st edition (January 24, 2006)
- Language : English
- Paperback : 633 pages
- ISBN-10 : 9780596009762
- ISBN-13 : 978-0596009762
- Item Weight : 2.03 pounds
- Dimensions : 7 x 1.4 x 9.19 inches
- Best Sellers Rank: #780,948 in Books (See Top 100 in Books)
- #41 in MySQL Guides
- #126 in SQL
- #147 in Data Warehousing (Books)
- Customer Reviews:
About the author

Discover more of the author’s books, see similar authors, read book recommendations and more.
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonCustomers say
Customers find this SQL cookbook extremely useful and appreciate its excellent explanations and examples. The book is well-written and serves as a great reference, with one customer noting it's particularly helpful for beginners and experts alike. Additionally, they value its comprehensive coverage across different relational database management systems, with examples provided for major SQL databases.
AI-generated from the text of customer reviews
Select to learn more
Customers find the book extremely useful and appreciate its content, with one customer noting it serves as a great on-hand resource for daily or occasional use.
"...However, this is the book that takes you to another level. This is the book that enables you to find solutions that others won't be able to...." Read more
"...problem in the text, but in the end, it definitely helped to improve my sql code reading, designing, and coding skills...." Read more
"...This has been an invaluable reference that sits on my desk and gets pulled down when I need a guide to accomplish a task...." Read more
"...It is the single most valuable reference book I have ever purchased. I very much recommend it." Read more
Customers find the book easy to understand, praising its excellent explanations and useful tips and tricks. They appreciate the examples provided and how it introduces various topics, with one customer noting it serves as an excellent reference for developers with secondary querying responsibilities.
"...This book turns you into a magician, and it is all hands on examples, no filler, no lengthy unneeded explanations. Learn by doing." Read more
"...However, this particular cookbook can also be used by less experienced programmers as part of "learning by example" methodology...." Read more
"...The time saved and effective solutions developed have proved this to be a valuable resource over and over again...." Read more
"...And one can gain a deep understanding of how SQL works. Always a plus for anyone that is new to an environment...." Read more
Customers find the book well written and easy to understand, with one customer noting it helps speed up problem solving.
"...The time saved and effective solutions developed have proved this to be a valuable resource over and over again...." Read more
"...It rates 5 stars. While Kindle is a very good format for reading a novel, it is an awful format for technical books like this...." Read more
"...I think the book is very well written and I would definitely recommend it to IT professional or students working towards IT degree programs...." Read more
"...and have already learned many quick tricks that have sped up my problem solving quite a bit. Very solid book for beginner and expert." Read more
Customers appreciate the book's coverage of database architecture, with one customer noting that it provides solutions for several different relational database management systems, while another mentions that examples are given for all major SQL databases.
"...In over 500 pages the author covers a lot of ground, for various DBMS, as can be seen on the front cover: SQL Server, PostgresSQL, Oracle, MySQL..." Read more
"...This book is setup for all levels of SQL users. You can easily skip through sections you already know and read further into the ones you want." Read more
"...scenarios it does so by going over solutions for several different relational database management systems including SQL Server, Oracle, MySQL, DB2..." Read more
"...to see that this book covers so many useful topics and it covers 4 databases...." Read more
Top reviews from the United States
There was a problem filtering reviews. Please reload the page.
- Reviewed in the United States on August 12, 2017It's the first SQL book I picked up, but be warned, it is for at least intermediate level users. So by the time I reached Chapter 3, I gave up and bought Ben-Gan's Fundamentals of T-SQL first (which I recommend going through before this book if you are a beginner).
If you are using T-SQL, I think Ben-Gan's book is a perfect intro to this one. However, this is the book that takes you to another level. This is the book that enables you to find solutions that others won't be able to. This is the book that makes you a player at work if you aren't a developer and you write SQL. There are no functions, triggers, optimization, table and view creation details. This book is about pulling whatever you want with those things already created (although there is a chapter on metadata and another on inserting/updating). So it isn't for everyone (Developers and Beginners especially).
Also, the book's date may scare people. I mean, the book could use an update as it is working with SQL Server 2005 (if you write T-SQL like I do). Based on the date, I'm sure the editions of the other platforms are outdated as well. With SQL Server 2005 capabilities though, you still get Window Functions, Pivots, string extraction, cast, convert, etc., and some of the Oracle functions not in SQL Server 2005 are a part of T-SQL in later editions, so at times, you can use the Oracle solution or pieces of it if you are using the latest edition of SQL Server (if you need to use lead and lag for example). The important functions that still exist are there for the most part (Concat for example, is not).
Most people know how to use partitioning, cases, and subqueries, but can they cast an integer as a string to cast it again into decimal, average that decimal using a case statement that filters out negative values and partition the average as a window function based on multiple criteria all in one line? This book turns you into a magician, and it is all hands on examples, no filler, no lengthy unneeded explanations. Learn by doing.
- Reviewed in the United States on July 1, 2009Majority of the cookbooks cater to seasoned programmers so they can quickly lookup a solution without having to reinvent the wheel. However, this particular cookbook can also be used by less experienced programmers as part of "learning by example" methodology.
After learning the sql basics, I had decided to purchase this text. I would read the problem statement and then try to implement the solution by myself. I would compare my solution to that of the author's. Or in certain cases, cheat by copying the given solution. It took me 3+ months to try each and every problem in the text, but in the end, it definitely helped to improve my sql code reading, designing, and coding skills.
I would recommend this book to anybody who is interested in mastering any flavor of sql.
- Reviewed in the United States on September 23, 2015When you work with SQL infrequently, as I do, but do things beyond the trivial, this book is an excellent way to dive right back into complex query tasks. This has been an invaluable reference that sits on my desk and gets pulled down when I need a guide to accomplish a task. It serves as a way to find a basic approach to the problem at hand and then I can adapt and perhaps combine one or more recipes to do the job. The time saved and effective solutions developed have proved this to be a valuable resource over and over again.
I am not sure how effective this book would be for someone who works on intermediate or advanced queries on a frequent basis. The recipes run the gamut from simple to complicated. However, for someone who needs to dive back in the queries once a month or so, it is a great reference to have on hand. The database-agnostic approach has also benefited me as I moved from an Oracle shop, to an outdated SQL Server shop, to a modern SQL Server shop.
- Reviewed in the United States on December 15, 2011I have owned this book since 2006, and I use it in a DB2 environment. I do not use SQL daily or perhaps I would have outgrown the book by now. As it is, the book is smudged and dogeared. It is the book I open every time I need to do something new with SQL, or something that I have not done for a long time. It is extremely well organized, and I rarely have to spend much time finding what I'm looking for. In all this time I have found only one example that was erroneous among all the various topics I've pursued; that was for a complex statement that could have been impacted by an update to DB2 over time. I think it's remarkable that a single book could be so useful over such a long period of time. It is the single most valuable reference book I have ever purchased. I very much recommend it.
Top reviews from other countries
-
AdriánReviewed in Mexico on September 10, 2019
5.0 out of 5 stars Excelente!!!
Lo que necesitaba para estudiar, con un detalle en el libro debido a la paquetería.
- ScottReviewed in Canada on April 17, 2019
5.0 out of 5 stars Excellent learning resource
These recipes teach you a tonne of fundamental techniques in a very clear way. Specific syntax examples are given for each database vendor for each recipe.
-
Massimo_JrReviewed in Italy on December 22, 2019
5.0 out of 5 stars Da leggere
Ottimo, moltissimi esempi e tecniche, soprattutto per chi lavora con i reporting services.
- dengmwReviewed in the United Kingdom on March 17, 2020
5.0 out of 5 stars Clear and easy to follow
Very easy to follow
- jorge marcanoReviewed in Canada on January 7, 2021
5.0 out of 5 stars Product on excelente conditions
Learning new skills