SQL Cookbook



Price: $26.37


SQL Cookbook (O'Reilly Media, Inc.) - December 2005Publisher: O'Reilly Media, Inc. - December 16, 2005

ISBN-10: 0596009763, ISBN-13: 9780596009762

Author: Anthony Molinaro


628 pages

One of the top-selling books


SQL Cookbook





Customer Reviews

a lot of trivial problems

The books has some worthwhile information in the last third of the book, but most of it is very basic material:

- how to get the smallest and largest values from a columns (use the min and max and group by functions - this is good for novices, of no use to me)
- how to insert a record ?
- counting rows in a table :-)
- it doesnt contain Sybase examples - though the syntax will work in most cases


In fairness there are some good parts as well, all I'm saying is this is not a great book if you are already experienced.
Its good for beginners.

Optimizing Transact SQl is far more useful for advanced SQL users.

Brandon H. Einhorn
19 September, 2010


Nice

I, for one, am very pleased with this product.

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 and DB2. In addition, I liked the organization of each solution: problem --> solution --> discussion.

Lastly, while some things will be obvious to a seasoned SQL developer, there are still a lot of things that I would expect will not be (for example, section 12.11 on
'Returning Non-GROUP BY Columns'). Also, as the book was published in 2006, it includes window functions.

So, all in all, I am very pleased with this book. Another book regarding SQL that I would recommend is 'SQL tuning', also published by O' Reilly.

Al Turri
16 August, 2010


SQL Cookbook

SQL Cookbook (Cookbooks (O'Reilly))

Interestingly, book doesn't so much compare SQL syntax as between the 5 featured databases but rather gives you different ways to go in accomplishing a particular task. Also, BEWARE as you will not find ANY DDL coverage, so if you are wondering why - for example - use of IDENTITY throws an error in MySQL, you are simply out of luck with respect to explainations and/or alternatives thereto. Remaining coverage is pretty concise and easy to understand.

SmithWorks
20 June, 2010


Chock-full of info, but needs an index!

I'm not going to summarize the text, since other reviews have done that very well. The only thing I want to contribute is that I bought the Kindle version for my iPod, and it doesn't have an index. I've had to return to the table of contents multiple times and still needed to guess where a keyword might appear. (Would you know, for example, that the "minus" set difference function appeared in the section titled, "Retrieving values from one table that do not exist in another" if you were unfamiliar with SQL?) There is so much information in this book that I reference constantly, and an index complete with hyperlinks to appropriate sections would have helped so much! As it is, I need the paper version of this book for my office, and the Kindle to read on the bus to work. Still, I would HIGHLY recommend this book to anyone who uses SQL, no matter what platform.

L. Rodriguez
06 May, 2010


An Excellent Value

The price I paid Amazon is a fourth of the list price. The book was listed as slightly damaged. But the damage is very minor - there is a wrinkle in the cover, and one page had a little section ripped off. I'll accept that level of damage any day.

I haven't spent as much time with it as I would like to, so my review is based on just a few uses. Molinaro starts off with very basic SQL. Then the examples get more interesting. What I like about the book is that it shows how to go from a verbal description of what information you want to the actual query that makes it happen.

Robert W. Clark
10 April, 2010


Great SQL book

A must have for any person who want to write advance SQL.

It has examples for DB2, Sybase, MSSQL, and Oracle.

S. Elias
18 March, 2010


Good stuff but kind of repetitive

I work a lot crunching data, and it turns out that i got a whole lot of good tips from this book... The problem is that somehow the tips got very repetitive. For beginners would be very helpful as repetitiveness might inspire different approaches, but for an advance user this variability is irritanting.. well, at least for me. - - even so... GOOD to have at hand.

Manuel Zarate Sinfonte
23 July, 2009


Other uses for this book

Majority 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.


F. Riaz
01 July, 2009


Good SQL reference

This books does what it's supposed to do. Lots of good solutions to SQL problems.

John F. Richards
14 June, 2009


Helped Me (a SQL Newbie) Deliver Cmplex SQL Reports

I was tasked with deliverying 6 key-performance-indicator (KPI) using SQL and Crystal Reports and an Oracle database. And for three disparate areas in the world (USA, Singapore, and The Netherlands).
Sure, I could write a 'SELECT' statement or perform and 'UPDATE'.
But, I did not know how to approach SQL as being a 'complete' solution for record selection.
The Crystal Reports portion was not too much trouble.
I was using the PL/SQL environment for creating the SQL. Oracle 10g.

Mr. Molinaro's book was instrumental in having me develop what turned out to be some rather complex SQL.
It took awhile to get to use SQL's window functions. But, the author's presentation/explanation made them more than approachable---and quite useful.
I liked the explanations that covered the multiple vendors' database engines.
I will make no pretense of having reached SQL knowledge 'nirvana'--However, there was more than one time where I was out of ideas on how to get/count certain data----The SQL Cookbook did its job by showinge 'yet another way' to approach a pressing problem with a solution.
And one can gain a deep understanding of how SQL works. Always a plus for anyone that is new to an environment.
If there was something like a SQL University, this book seems to be text that would work very well for giving students more than enough 'footing' to face the 'real' world. It did for me.
I am more than pleased to have this book as part of my SQL 'library.'

John R. Spencer
25 November, 2008


SQL Tookbox Must-Have

The thing I like about the O'Reilly 'Cookbook' series is that you may not have to use them for months, but when you need them they are there with the answers. And oftentimes finding the "one answer" that has been eluding you for hours or even days is worth the price of the book.
This book falls into that category. What's really nice is that the author provides solutions for 5(!) different databases. And he does a good job explaining the solutions, making it easy to extrapolate them to solve similar queries.

Larry
27 September, 2008


Useful fast reference

This book is great for those times when you say "there must be an easier way to do this". It's concise, readable, and easy to find your way around.
I almost never have time to plough through a two-inch thick book to learn a single technology in agonizing detail. More usually I have an immediate problem needing an immediate fix. And this book fills that need. Furthermore since it covers Oracle, Sybase and Sql Server and addresses both similarities and differences between them it's good for those of us who have to bounce between different DBMSs on a daily basis.

Buy this book. You will not regret it.

Robert Noble
09 September, 2008


Good book, but shipped falling apart

Content is excellent, with good examples. I was able to solve a prloblem the very first time I used it. The issue I have is more with Amazon in that I ordered this book in a shipment of 4 others, so it was over a month before I cracked this one open. To my dismay, the binding is not glued on and the book is falling apart. Amazon customer service has not even responded to my three emails asking for resolution.



flattenedfrog
07 March, 2008


A great book!

I am a certified DB2 / Oracle DBA and a programmer. Even though, I can get through some of chapters very fast, I certainly have enjoyed reading it so far. One thing I like the most is to see how a problem is solved in many different databases including DB2, Oracle, MS-SQL, MySQL, and PostSQL!


Behzad Pirvali
25 February, 2008


As a reference

I found this book to be very complete. Providing solutions for multiple DBMSs was greately appreciated. I have been in I.T. for a long time and I have read many many books on all types of subjects. I often (too often) am disappointed with books I purchase. However, sometimes I am pleasantly surprised... this is one of those time.

I create numerous queries using all types of tools. As such, I sometimes insert the wrong syntax into a query. This book helps to quickly correct the error. In addition, it has given me some "tricks" that I was unaware of that have helped to simplify some of my queries.

It would be very advantageous to have the info in this book on a searchable site or application

Buy it, read it, and keep it close by to reference to.

Michael Bingle
25 February, 2008


It is real cook book

I am completely satisfied with this book.
Instead of inventing all the time "bicycle" I can use this book in my everyday work and concentrate on more important things in my projects.


Oleg Savkin
03 August, 2007


MS SQL Server must be 2005

This is a great product but some of the advanced features weren't available in SQL Server 2000. I really liked the windowing and hierarchical queries in this book but those features are not available in 2000. For the most part 2000 isn't used that often anymore but if you are one of the unfortunate to have to use it there will be some compatibility problems with the examples in this book.

Robert A. Meidal
26 June, 2007


Mind-expanding

It doesn't take long to learn the basics of SQL. Once you start to do multi-table joins and you get to sub-selects and outer joins you can almost convince yourself you are an expert. Trust me. You aren't. I've read at least ten books on using SQL. This is the first one to blow my horizons away and open a completely new landscape.

The "recipies" are well explained and almost entirely practical and useful. This book showed me dozens of things I did not ever think of using SQL for, even though I have the BNF for SQL pretty much in my head after more than 18 years of being a practicing programmer.

Before this book I used to recommend "generic" SQL books to students and newbies because such books apply to virtually all SQL databases and it can be harmful for one to use a specific "dialect" (such as Oracle or SQL Server) that won't port to other SQL databases. I would urge people to learn "generic" SQL. You can always add the features of you specific dialect, but it is hard to give up features you assume will be in all dialects.

This book neatly avoids that problem by providing dialect-specific sections when you can or must code differently for a particular database. Even better, they explain the differences and the pros and cons of those differences. So this book can even be an aid to selecting the "right" database for your application.

I happen to be a fan of Open Source and Free Software and I'm pleased to say that this book covers both MySQL and PostgreSQL. Naturally it provides the "big three" of Oracle, Microsoft SQL Server, and IBM's DB2.

This book really opened my eyes to possibilities in SQL that I really didn't know existed in spite of the fact that I have been using the language (apparently without mastering it) for almost two decades.

I still recommend using a "generic SQL" book to learn the basics, but this should literally be ordered at the same time. It is the best of the "Cookbook" series that I have seen. (And I have used the Java Cookbook, Perl Cookbook, and Python Cookbook).


M. Schwarz
09 May, 2007


Too long; get the Sams 10 minute series

Too long at 600 pages. Sure you'll understand SQL if you go through all 600 pages and understand them well. Heck that's true for any subject, including the Qu'ran. But who'se got the time? Get the Sams Teach Yourself SQL in 10 Minutes, Third Edition - Ben Forta; and in about a day you'll be half way towards mastery. But if you don't value your time, perhaps you're still a student rather than a professional, then by all means read this book.

A_2007_reader
13 April, 2007


Everything you need

The Cookbook series has always been a reference for users that had at least some knowledge of the subject.
But even if you are just starting out, you can get started right away with writing commands. And since this book covers the major SQL formats, you won't be left out. I bought this book because an application uses Oracle and I was able to do what I needed to do. The great thing about the cookbook series is that you don't have to go through alot of text to get what you want. You find your problem and apply the solution.
Great book!!!

Chris Johnson
09 January, 2007


Good tutorial on and selection of recipes solving problems with SQL

Ultimately, the goal of this book is to give you a glimpse of what can be done using SQL outside of what is considered the typical SQL problem domain. This text is unique in that the target audience is wide, incorporating all levels of SQL programmers as well as those who are completely unfamiliar with SQL.

Both complex and simple solutions are provided, and solutions for five different vendors are available when a common solution does not exist. These five databases are DB2 v.8, Oracle Database 10g (with the exception of a handful of recipes, the solutions will work for Oracle8i Database and Oracle9i Database as well), PostgreSQL 8, SQL Server 2005 and MySQL 5. All of the examples are built around a small set of tables containing employee data. This helps the reader get familiar with the example data, so that, having become familiar with the data, you can focus on the technique that each recipe illustrates.

Chapter 1, Retrieving Records, introduces very simple queries. Examples include how to use a WHERE clause to restrict rows from your result set, providing aliases for columns in your result set, using an inline view to reference aliased columns, using simple conditional logic, limiting the number of rows returned by a query, returning random records, and finding NULL values. Most of the examples are very simple, but some of them appear in later more complex recipes, so it's a good idea to read this chapter if you're relatively new to SQL or aren't familiar with any of the examples listed for this chapter.

Chapter 2, Sorting Query Results, introduces recipes for sorting query results. The ORDER BY clause is introduced and is used to sort query results. Examples increase in complexity ranging from simple, single-column ordering, to ordering by substrings, to ordering based on conditional expressions.

Chapter 3, Working with Multiple Tables, introduces recipes for combining data from multiple tables. If you are new to SQL or are a bit rusty on joins, this is a good chapter to read before going on to Chapter 5 and later. Joining tables is what SQL is all about; you must understand joins to be successful. Examples in this chapter include performing both inner and outer joins, identifying Cartesian productions, basic set operations (set difference, union, intersection), and the effects of joins on aggregate functions.

Chapter 4, Inserting, Updating, Deleting, introduces recipes for inserting, updating, and deleting data, respectively. Most of the examples are very straightforward, perhaps even pedestrian. Nevertheless, operations such as inserting rows into one table from another table, the use of correlated subqueries in updates, an understanding of the effects of NULLs, and knowledge of new features such as multi-table inserts and the MERGE command are extremely useful for your toolbox.

Chapter 5, Metadata Queries, introduces recipes for getting at your database metadata. It's often very useful to find the indexes, constraints, and tables in your schema. The simple recipes here allow you to gain information about your schema. Additionally, "dynamic" SQL examples are shown here as well, i.e., SQL generated by SQL.

Chapter 6, Working with Strings, introduces recipes for manipulating strings. SQL is not known for its string parsing capabilities, but with a little creativity, usually involving Cartesian products, along with the vast array of vendor-specific functions, you can accomplish quite a bit. Some of the more interesting examples include counting the occurrences of a character in a string, creating delimited lists from table rows, converting delimited lists and strings into rows, and separating numeric and character data from a string of alphanumeric characters.

Chapter 7, Working with Numbers, introduces recipes for common number crunching. You'll learn how easily window functions solve problems involving moving calculations and aggregations. Examples include creating running totals; finding mean, median, and mode; calculating percentiles; and accounting for NULL while performing aggregations.

Chapter 8, Date Arithmetic, is the first of two chapters dealing with dates. Being able to perform simple date arithmetic is crucial to everyday tasks. Examples include determining the number of business days between two dates, calculating the difference between two dates in different units of time (day, month, year, etc.), and counting occurrences of days in a month.

Chapter 9, Date Manipulation, is the second of the two chapters dealing with dates. In this chapter you will find recipes for some of the most common date operations you will encounter in a typical work day. Examples include returning all days in a year, finding leap years, finding first and last days of a month, creating a calendar, and filling in missing dates for a range of dates.

Chapter 10, Working with Ranges, introduces recipes for identifying values in ranges, and for creating ranges of values. Examples include automatically generating a sequence of rows, filling in missing numeric values for a range of values, locating the beginning and end of a range of values, and locating consecutive values.

Chapter 11, Advanced Searching, introduces recipes that are crucial for everyday development and yet sometimes slip through the cracks. These recipes are not any more difficult than others, yet many developers make very inefficient attempts at solving the problems these recipes solve. Examples from this chapter include finding knight values, paginating through a result set, skipping rows from a table, finding reciprocals, selecting the top n records, and ranking results.

Chapter 12, Reporting and Warehousing, introduces queries typically used in warehousing or generating complex reports. Examples include converting rows into columns and vice versa (cross-tab reports), creating buckets or groups of data, creating histograms, calculating simple and complete subtotals, performing aggregations over a moving window of rows, and grouping rows based on given units of time.

Chapter 13, Hierarchical Queries, introduces hierarchical recipes. Regardless of how your data is modeled, at some point you will be asked to format data such that it represents a tree or parent-child relationship. This chapter provides recipes accomplishing these tasks. Creating tree-structured result sets can be cumbersome with traditional SQL, so vendor-supplied functions are particularly useful in this chapter. Examples include expressing a parent-child relationship, traversing a hierarchy from root to leaf, and rolling up a hierarchy.

Chapter 14, Odds 'n' Ends, is a collection of miscellaneous recipes that didn't fit into any other problem domain, but that nevertheless are interesting and useful. This chapter is different from the rest in that it focuses on vendor-specific solutions only. This is the only chapter of the book where each recipe highlights only one vendor. In some cases, though, you'll be able to easily tweak a solution provided in this chapter to work for a platform not covered in the recipe.

Appendix A, Window Function Refresher, is a window function refresher along with a solid discussion of groups in SQL. Window functions are new to most, so it is appropriate that this appendix serves as a brief tutorial. Additionally, the use of GROUP BY in queries is a source of confusion for many developers. This chapter defines exactly what a SQL group is, and then proceeds to use various queries as proofs to validate that definition. The chapter then goes into the effects of NULLs on groups, aggregates, and partitions. Lastly, you'll find discussion on the more obscure and yet extremely powerful syntax of the window function's OVER clause (i.e., the "framing" or "windowing" clause).

Appendix B, Rozenshtein Revisited, is a tribute to David Rozenshtein, author of "The Essence of SQL". Appendix B focuses on some of the queries presented in "The Essence of SQL", and provides alternative solutions using window functions (which weren't available when The Essence of SQL was written) for those queries.

I highly recommend this book for anyone working with or interested in working with SQL. However, you should already be familiar with the theory behind database management or you will have trouble with this book.

calvinnme
08 January, 2007


Bring something new in my arsenal

You can hardly go wrong with a cookbook from O'Reilly; they invented the format and delivered many first class recipe books along the years. SQL Cookbook lives up to the expectations. The author covers five different RDMS, being a freelance consultant I fund this especially valuable, since I sometimes need to switch among different databases. The amount of explanations and recipes leveraging the window functions are, in my opinion, another major plus; window functions are still relatively new for me (I am an application developer, not a DBA), and seeing them in action bring something new in my arsenal.

Foti Massimo
24 December, 2006


Neatly written guide for Sql Developers

O'Reilly's SQL Cookbook is the reference I've seen for SQL developers and personally suggest all developers intrested in SQL to must read it. Modeled after a true cookbook, it offers many short snippets of SQL code designed to solve specific problems. You can pick and choose the components you need to help complete your SQL project. Each item in the cookbook is clearly explained in a well defined format. High recommendation for Sql Dev's. A must read.



Vikramaditya Jakkula
17 October, 2006


Go get this book

It really helps when you need to find SQL query tips in your real projects

B. Yuan
14 October, 2006


Good Book

This is the wonderful SQL book. When I read in Borders, I was suprised to see that this book covers so many useful topics and it covers 4 databases.

It introduces so many useful topics and describes SQL command in detail. I really like that.

I am waiting to see if the author can add the content of useful skills of "Stored Procedures" or "Triggers" in the future.


Yung-Yi Lin
20 September, 2006


Excellent Recipes for both novice and expert programmers

I am really glad I bought this book. This book covers substantial amount of sql problems that you would practically come across.

-For each problem, the book illustrates the solution and the rationale behind it. It also discusses solution for different databases.
-Each problem/solution is discussed for MySQL, Oracle, PostgreSQL, DB2 and SQL Server.
-Best thing I like about the book is that it doesn't just discuss the solution but it also gives you enough details so that you understand the database specific behaviour. For e.g. 'rownum' concept in Oracle is very nicely explained with respect to the context.
-I have been writing SQLs for years. Still I came across very valuable techniques and tricks that I had not heard or used before buying this book.
-The explanation style used in this book is also very reader friendly. What I mean is a lot of technical books get very very technical and boring. I felt exactly the opposite while reading this book. If there is a concept that you should understand before book discusses it in details, this book makes sure that it is explained enough for you to dive into the details given later.

I would highly recommend this book for anyone looking to have a reference SQL book that would help them get answers to common and advanced SQL problems in day to day SQL programming.

CyberSimba
25 August, 2006


"COOKING WITH SQL"

Are you an SQL novice, journeyman, expert or a non-SQL programmer? If you are, then this book is for you! Author Anthony Molinaro, has done an outstanding job of writing a practical book that gives you the reader, a glimpse of what can be done using SQL outside of what is considered the typical SQL problem domain..

Molinaro, begins by introducing very simple queries. Then, the author introduces recipes for sorting query results. Next, he introduces recipes for combining data from multiple tables. The author then introduces recipes for inserting, updating, and deleting data, respectively. He continues by introducing recipes for getting at your database metadata. Then, the author introduces recipes for manipulating strings. Next, he introduces recipes for common number crunching. He also deals with data arithmetic. The author continues by showing you recipes for some of the most common date operations you will encounter in a typical work day. Then, he introduces recipes for identifying values in ranges, and for creating ranges of values. Next, the author introduces recipes that are crucial for everyday development and yet sometimes slip through the cracks. He also introduces queries typically used in warehousing or generating complex reports. The author continues by introducing you to hierarchical recipes. Finally, the author focuses on vendor-specific solutions.

In this most excellent cookbook, you will find a collection of common SQL problems and their solutions that you'll find helpful in your day-to-day work. More importantly, this cookbook will help you take your SQL skills to the next level.


John R. Vacca
16 July, 2006


Excellent desktop resource book!

This book review was submitted by a Roanoke Valley SQL Server Users Group member as part of the Book Review Program.

Reviewed by: Harold Buckner
This is a great book to have available at your fingertips. The table of contents is structured quite nicely and allows you to find what you need very quickly. The book covers a number of topics for solving everyday problems. It will also help you come up with ideas on how to go about handling particular queries by describing the problems and then listing possible solutions. And in these solutions you can find techniques on how to expand on them to resolve other issues.

The author Anthony Molinaro, included a chapter on Metadata Queries that would be great for the beginner DBA wanting to find information about the database schema as well as other chapters on String manipulation, working with numbers, dates, warehousing and hierarchical queries. The author includes solutions for various platforms that I thought were nice to see how the different platforms handled the solutions. I also thought the author did a great job expanding the solution to help you understand what was happening.

Great job Anthony and I hope to see more structured like this one.

Harold Buckner


RVSSUG
03 July, 2006


Love this cookbook

This is definitely a fantastic book. As a web developer in Kansas City, I have great need for providing my clients with great programming. This book is an integral part of my library.

My favorite topics in here are:
- Retrieving Records Section-really like searching for patterns
- Working with ranges..used this one with a client.
- Reporting (Great need for online businesses)

Thanks Anthony - Great book review from me!

Sean Morelli
RPG Designs, LLC - Kansas City Web Design firm


Sean Morelli
15 June, 2006


Make You Look SMARTER in SQL

I thought SQL was dull.

But this cookbook changed the way I thought about SQL.

There were a lot that I thought I can't do in SQL, but Anthony used lively, practical and interesting example to demonstrate the power of SQL, to prove that I'm wrong over and over again.

To me it is mind-blowing. And I definitely do look smarter in SQL now.

Trevor
14 June, 2006


Quite inconsistent and confusing book

Maybe not a bad source for an exepienced SQL programmer, but very frustrating for a beginner. There's no such thing as "generic SQL"; regretfully, it's vendor-specific and doesn't really comply ANSI stndards...

Jeremy Flynn
05 June, 2006


OUTSTANDING!!!!

Chock full of SQL tips, tricks, and goodies, this is the kind of Cookbook that I would expect as it relates to this topic. Any SQL programmer could stand to learn from the best and learn the techniques that will make their DB code shine, and having this book by your side will only help you take the journey to greatness in the SQL world.

Required purchase for any SQL developer... period.

***** HIGHLY RECOMMENDED

Daniel McKinnon
18 May, 2006


For developers who know the basics of the SQL query language but don't know enough about its advanced capabilities

Anthony Molinaro's SQL Cookbook: Query Solutions And Techniques For Database Developers is for developers who know the basics of the SQL query language but don't know enough about its advanced capabilities. There's a lot which can be accomplished with SQL: developer Molinaro covers all the techniques and features which make this language important. From using pivot operators and MODEL clauses to creating histograms, summarizing data into buckets, and walking a string, SQL Cookbook uses a problem/solution format to allow for quick and easy referencing for troubleshooters, yet is basic enough for relative newcomers to learn from.

Midwest Book Review
02 May, 2006


Excellent SQL book

I really like this book. It is an excellent book for anyone who wants to learn SQL and takes advantage of the power of SQL. If you are developing software or application to support multiple database platform, this is a must have reference. If you are familiar one databse platform, such as Oracle, and now you are working on different database platform, such as MySql, it will help you to grasp it in no time.



Ming Fang
16 March, 2006


It is an excellent book for sql tips

It is a great book and will show you some of the cool ways you can use sql to do some of the most complicated tasks which we usually think of in terms of a stored procedure

Shekar Jakati
10 March, 2006


Finally another good cookbook for the arsenal!!!

A perfectly written SQL cookbook that both the SQL DBA and the casual SQL enthusiast can use. With common world examples this cookbook has helped me tremendously with daily SQL tasks and OLAP tuning. Nicely Done!

Brian F. Vaughan
28 February, 2006


Sick Book

This book is awsome!! Dawg, your a sick writer. It helped me through out my course work. The author must be a genius!!!

Danny Peled
06 February, 2006


SQL Cookbook by Anthony Molinaro

The book: SQL Cookbook by Anthony Molinaro, is an outstanding book. It is a book long overdue. Anthony provides solutions to everyday, real world problems with straight SQL for 5 databases: Oracle, DB2, SQL Server, PostgresSQL, and MySQL. I have also run some of his solutions in Sybase and Microsoft Access databases and those solutions worked, also. Next, I decided to run some of his code in Crystal Reports and Impromptu and that worked, also.

I recommend this book for all Developers, DBAs, Database Architects, SQL Programmers, SQL Experts, Report Writers, Power Users, and anyone who wishes to enhance and increase their knowledge in writing SQL. This is a "must have" book.


Eddie
27 January, 2006


excellent explanations

the chapter on reporting and warehousing queries is what made me decide to pick up this book.

the author's approach to explaining queries is great.
the author takes his time explaining these queries step by step and showing what each construct of a query does.
But what i found most useful for understanding is that the author also shows what the result sets would look like WITHOUT specific constructs. by doing this, you see exactly what these constructs mean to the final result set, why the author uses them, and what the query would look like without them.

i find it easier to understand the big picture this way
as the author explains WHY certain parts of the query are necessary and does so by showing what the results look like without them as well.
a perfect example, the author spends 11 pages carefully explaining and breaking down single and multiple row pivots (also referred to as transpositions) by:
1. showing the steps to build these queries from scratch
2. showing what the result sets look like along the way
3. showing what changing specific aspects of the query means
to the final result set and intermediate result sets alike.
that's the key for me, not just explaining how changes effect the result set, but actually showing the intermediate result sets and how they change.

bottom line: the author doesnt rush through the explanations and doesn't make you feel like you should already see what's going on. i find it much easier to grasp complex queries this way.


Felix Gottlieb
26 January, 2006


Fantastic resource for anyone using SQL

This is a great book for anyone writing SQL. Get it right now.

Oh, you want a reason? Ok. The chapter on querying hierarchal data effeciently, which is the bane of all SQL programmers, is worth the money right there. Oh, yeah, and the other chapters are great too.

Get it. Right now.

Jack D. Herrington
26 January, 2006


Excellent book on SQL and the platforms recognized in this book!

This book is just fantastic. One really needs to read the inside cover pages to see what this book doesn't try to do. The relevant elements are:

Non-political (on several SQL-specific fronts)
Non-Pure ANSI (portability versus vendor-specific features)
Non-platform (I couldn't find a mention of a particular platform)

Basically, the book focuses on how to accomplish numerous SQL tasks using SQL and those features found on some of the top RDBMS vendors' products. It is selective in that the focus is constrained to MS SQL (platform obvious, but not mentioned that I could find) Server, DB2, MySQL, PostgresSQL and Oracle. I think that this well represents at least the 80/20 rule of who's running what RDBMS.

The book is a set of recipes for (usually) each of these platforms. Each recipe is a code-demonstrated "how-to" for accomplishing the given task. This is perfect for those who don't want to become DBAs and focus on learning "too" much about SQL, rather, want to use an example in their code to make it do the right thing.

The book is very well written and finished. It is a joy to read.

The one detraction that I can think of is that it would be nice to see all of the examples online at O'Reilly's web site so that we could "play around with them" somewhat without having to enter the database table contents and all of the SQL by hand. It "ain't that hard," but who's got the time to do it? I think that having the code available with the book would make it an excellent training tool for newcomers to SQL and those switching to a different product such as going from Oracle or MS SQL to MySQL or PostgresSQL. However, as it is, the book is a 4.5 stars product. If you're interested solely in MySQL, check out the MySQL Cookbook from O'Reilly.

Rob Wehrli
19 January, 2006


Finally!

If ever there was a language that required someone make a cookbook it's SQL. The use of OLAP functions to solve problems when available is an intriguing approach. Great examples, realistic problems, piecewise explanations. Being able to see the different syntax for each platform is great. nicely done.

dan loeshe
14 January, 2006


an eye opener for undergrads and grads alike

as a recent graduate i was surprised by the sql i came across
once i started working. as an undergrad i was required to use elmasri/navathe and felt that book did a nice job
of teaching database fundementals, but it really doesn't prepare you for real world sql.
other courses with end of semester and group projects
were realistic enough that the learning curve once you begin working is tiny.
not so, for sql. the sql you're taught is nothing close to the pollution that's out there.
this book does a great job showing and explaining real world sql, using a step by step approach.

the first 2 chapters were lame intros that i suggest you skip unless you're a complete noob.
things get interesting as early as chapter 3 when recipes like "performing joins/outer-joins
with aggregation" are introduced.

a very nice book that would be very useful as a supplement to any undergrad taking a database course
who wants to get a taste of real world sql.

Neil "real deal" Shapiro
13 January, 2006


How much better can it get!

This text offers a systematic approach to tackle even the most complex issues that can be confronted in such a technically demanding subject! It's an elegant answer to some potentially ugly problems that can occur.

KCHIZZLE
11 January, 2006


Indispensable

Molinaro's book is an incredible resource, and sets a new standard. No matter how old a hand you are at SQL, you will learn a great deal from this book. I certainly have.

Jeffrey K. Tyzzer
10 January, 2006


Hand's down GREAT!

O'Reilly cookbooks are always a great way to quickly solve everyday problems...but this one goes above and beyond when it comes to solving sql problems! Within the first 5 minutes of flipping through the book I was able to get pure sql solutions to two of the more nagging problems I was using a lot of other code to accomplish (turning table rows into a delimited list, and parsing ip addresses in a field).

As a few other reviews have mentioned, it was really great to also have solutions for various DBs listed side-by-side. For consultants like me who are forced to work with a variety of databases, it makes my job A LOT easier knowing I can just turn to this book to get the syntax of a specific trick no matter if I'm working with Oracle, MySQL, SQL Server, PostgresSQL, or even SQL Light.

If you have a need to interact with a database, this book will def. give you some tips and tricks to make your life easier AND most likely speed up the performance of your apps.

K. Marshall
03 January, 2006


a great second book on sql

because the focus is on queries (the author states this on the cover and preface) you'll need a more traditional book on learning sql if you are completely new to it.
once you know the basics, this is a great "where to go next" book. there are chapters for complete novices, but being a "cookbook" (q&a format), i would not suggest this text as your only text on sql. instead this would make a good supplement to any of the intro sql books avaialable.
This book does a nice job of showing when and how to use different constructs of sql.
for example, once you learn GROUP BY (there is a window/group by tutorial in the back of the book), you might wonder when exactly do you use it or what queries do you use it for?
the recipes in this book do a nice job of explaining how various sql constructs (aggregates, window functions, pivot queries, etc) work and when to use them by tying verbal descriptions to real queries.
this is a good book for novice or intermediate developers looking to take their sql to the next level or dbas looking to improve their sql skills.

BrianSt.Pierre
28 December, 2005


great book a different sql queries

a nice collection of queries. some difficult, some very easy. showing the different syntax for each rdbms was a nice touch.
the new sql movement using these "window functions" is very interesting.
a good book.

pifermat
28 December, 2005


kudos oreilly and molinaro

for breaking the mold of sql books and providing something fresh and new. a collection of useful and entertaining sql queries for five different rdbms. it's interesting being able to compare different syntax and functions provided by each indiviual vendor side by side.
if you're serious about database development you are taking advantage of whatever functionality you can. by providing recipes that use vendor specific functionality, this book is immediately useful.


vasa ramadajan
24 December, 2005


sql minimalism

Of the many things i like about this book is that many times the queries accomplish so much with so little code. Two examples that immediately caught my eye are the join-less versions of computing medians and running totals. Those two operations typically involve self-joins and can be inneffiicent if the tables are large.

Though I haven't tried the proposed solutions, they look promising simply because joins are no longer necessary! I also thought the "walking a string" technique was very clever considering sql does not have loops. Besides the "new-style" sql, what real sets this book apart are three things:

1. 5 vendors shown side by side. this is the first text I've seen that shows solutions for oracle, sql server, db2, mysql, and postgresql side by side, and all in their native syntax.
When i saw all the different vendors listed on the cover, I thought the author was going to mix and match(ie, show one vendor here, one vendor there). To my surprise, each solution shows all 5 versions when a single universal solution isn't available!

2. Longer queries are given longer explanations and shorter queries are given shorter ones. brilliant.

3. The intermediate steps are extremely helpful. when given more involved queries the author not only explains each portion of the query but shows their results. I find this particularly helpful as i dont have to try to visualize what each particular join or function-call does to the result set. The author takes complex sql, breaks it down to simple form, and builds it back
up again to the final solution showing the intermediate result sets all the way. This makes the recipes easy to understand.



Gary Sussman
21 December, 2005