Enter your mobile number below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.
Getting the download link through email is temporarily not available. Please check back later.

  • Apple
  • Android
  • Windows Phone
  • Android

To get the free app, enter your mobile phone number.

Joe Celko's SQL for Smarties: Advanced SQL Programming Second Edition (The Morgan Kaufmann Series in Data Management Systems) 1st Edition

4.2 out of 5 stars 26 customer reviews
ISBN-13: 978-1558605763
ISBN-10: 1558605762
Why is ISBN important?
This bar-code number lets you verify that you're getting exactly the right version or edition of a book. The 13-digit and 10-digit formats both work.
Scan an ISBN with your phone
Use the Amazon App to scan ISBNs and compare prices.
Have one to sell? Sell on Amazon
Buy used
Condition: Used - Good
Condition: Used: Good
Comment: Support Your Planet. Buy CLEAN EARTH BOOKS. Shipping orders swiftly since 2008. A great value for the avid reader! GOOD can range from a well cared for book in great condition to average with signs of slight wear. Overall, All text in great shape! Comes with our 100% Money Back Guarantee. Our customer service can't be beat! Tracking included on all orders.
Access codes and supplements are not guaranteed with used items.
48 Used from $0.01
FREE Shipping on orders over $25.
More Buying Choices
14 New from $15.79 48 Used from $0.01

click to open popover

Editorial Reviews

From the Back Cover

SQL for Smarties was hailed as the first book devoted explicitly to the advanced techniques you need to transform yourself into an expert SQL programmer. Now, in this fully updated second edition, SQL mastermind Joe Celko keeps you moving forward, using his entertaining, conversational style to teach you the best solutions to old and new challenges and to convey the way you need to think if you really want to get the most out of your SQL programming efforts.

Inside, logic- and set-based analyses replace the traditional, procedural approach to problem-solving, helping you make the conceptual leap that separates an SQL guru from the rest of the pack. As you catch on to Celko's approach, you'll devour what he has to say about some of SQL's toughest topics: how aggregate functions really work, the best way to work with NULLs, how and why to fake array structures, and much more.

This book gives special emphasis to SQL-92 and product-independent techniques that let you optimize performance or achieve highly specialized behavior, regardless of the RDBMS with which you work. If you're serious about SQL, you won't let SQL for Smarties out of your sight.


  • Presents all-new war stories that give you insight into real-world SQL programming challenges.
  • Continues to cover SQL-89 but focuses heavily on the SQL-92 standard.
  • Offers still more undocumented tips for working around system deficiencies.
  • Teaches scores of advanced techniques that can be used with any product, in any SQL environment.
  • Offers expert advice from a noted SQL authority and award-winning columnist.

About the Author

Joe Celko served 10 years on ANSI/ISO SQL Standards Committee and contributed to the SQL-89 and SQL-92 Standards.

Mr. Celko is author a series of books on SQL and RDBMS for Elsevier/MKP. He is an independent consultant based in Austin, Texas.

He has written over 1200 columns in the computer trade and academic press, mostly dealing with data and databases.

New York Times best sellers
Browse the New York Times best sellers in popular categories like Fiction, Nonfiction, Picture Books and more. See more

Product Details

  • Series: The Morgan Kaufmann Series in Data Management Systems
  • Paperback: 550 pages
  • Publisher: Morgan Kaufmann; 1 edition (October 25, 1999)
  • Language: English
  • ISBN-10: 1558605762
  • ISBN-13: 978-1558605763
  • Product Dimensions: 9 x 7 x 1.4 inches
  • Shipping Weight: 1.9 pounds
  • Average Customer Review: 4.2 out of 5 stars  See all reviews (26 customer reviews)
  • Amazon Best Sellers Rank: #1,476,845 in Books (See Top 100 in Books)

Customer Reviews

Top Customer Reviews

Format: Paperback
First of all, I couldn't recommend this book for beginners. It is, however, PERFECT for the SQL programmer with some experience who is looking to take his/her SQL abilities to the next level. There are great pure SQL solutions for problems that many programmers think must be done outside of SQL in a host language. One of the most important lessons from the book is this: think in terms of sets and set theory instead of in terms of columns and rows. Lots of other great info though. Be warned: the examples are all written in the SQL-92 ANSI standard. Examples will have to be modified if your vendor-specific implementation of SQL doesn't follow the standard precisely. Kudos to Joe.
Comment 45 people found this helpful. Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again
Report abuse
Format: Paperback
Not so much unimpressed at Joe's knowledge, which is impressive indeed: the book reads a lot more like a teaching text than most technical books.
But there are things in here which may lead astray some who have already done things that Joe advises strongly against. I will concentrate on one example: In chapter 3 "Numeric Data in SQL", under the heading "Generator Functions" (e.g., IDENTITY, AUTO_INCREMENT) we get this doozy: "This is a horrible, nonstandard, nonrelational proprietary extension that should be avoided whenever possible". Just a statement, no reason whatsoever provided for it, because I guess he assumes we know some "math rule" or something behind why it is such a bad idea. Now, we must think for a minute why one uses such a data column. In my own case, I have a table called Parts that contains parts from several different companies. So, I guess Joe would have me make a composite primary key from PN and CompanyID. But, wait a minute, that complicates matters when I need to have a foreign key reference to the Parts table, and, oh by the way, just what is CompanyID anyway, maybe some other composite key, or some goofy "rule-based" (can you say TRIBAL KNOWLEDGE) thing? You can't seriously believe that "ALFKI" is a better key than,say, 33. What happens when I get a new customer named "Alfred Kiplinger", and have to change the "rule" that I came up with for defining the primary key? See the problem? You're not going to remember the ID anyway, because the rule will be broken at some point. I also happen to think that a part number (to give one example) should be changeable. So, I don't make PN the primary key (because you should NEVER change a PK), I simply have the database generate one for me.
Read more ›
13 Comments 158 people found this helpful. Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again
Report abuse
Format: Paperback
My first problem with this book is its errors. ... there must be one on every page. There's way, way too many typos for a book like this. Half the examples won't work without corrections.
My second problem is that the book is rife with academic exercises that have little application in the real world. Code that uses cross joins will not perform well against even moderately sized data sets. Most of the examples make great magazine pieces, but fall short of anything that's actually useful in the real world.
Third, Celko likes to use syntax that has been implemented on paper only. For example, he uses set operations that no vendor has yet implemented (and probably never will since they became part of the ANSI standard years ago). A fair number of the examples in this book use code that will not run on any DBMS - even after you clean up the typos....
In sum, this book was a good idea, it's just a poor implementation. Celko needs to do some real DBA work and write from that experience. Saying "different DBMSs implement things differently - see your vendor docs" on every other page doesn't help anyone.
Comment 45 people found this helpful. Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again
Report abuse
Format: Paperback Verified Purchase
I cannot work without this book. Stuck with a poor database structure and huge volumes of data, I have had to explore every trick of the trade. Few computer books in general provide information that is accurate, helpful, and not repetitive of manuals and online material that is already available to you. This book is of exceptional value. Someone swiped mine and believe me, I must have another copy. How many of the computer books you have purchased get that kind of respect?
Warning: Beginners may need another book and it is not a replacement for your SQL vendor specific reference.
Comment 18 people found this helpful. Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again
Report abuse
Format: Paperback
Joe Celko knows SQL. He may make some typos as a writer but make no mistake... this guy knows what he's talking about. He knows the language and the mechanics of the major database engines. But more importantly, he understands the logic of it all. Some of his SQL moves are simply brilliant.
I develop enterprise applications and am called upon now and then to create some very challenging SQL. Celko has bailed me out several times. I have the book as a reference source right next to my database reference manuals. He is full of ideas and often times I am looking for an idea, not a recipe.
This is a book for people who have a good knowledge of SQL. It will stimulate your thinking and programming. It isn't a book for beginners. In the right hands, SQL for Smarties will really add some sizzle to your SQL coding.
Brianne Elizabeth Corbett - IBM Global Services
Comment 9 people found this helpful. Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again
Report abuse
Format: Paperback
I knew of Joe Celko from his contributions to database-related magazines and had great expectations of this work.
However, while there is much in the book that is worthwhile, I found it terribly sloppy, not only in the practical solutions supplied but in all aspects of the book. Nearly every sample piece of code, even quite short snippets, has a bug in it; the descriptions of the problems he is attempting to solve and the explanations of the solutions are full of unstated assumptions; and much of the general text is imprecise or vague and skims over areas that could do with more detailed explanations. Some parts I have read several times over without being able to make any sense of them.
In fact, I have come to the point where, if a section of text or a practical example seems wrong or difficult to follow, I don't know any more if it's Joe's fault or mine.
To Joe's credit, I can say that I have corresponded with him and he was quick to reply and was willing to continue the discussion when I followed up. He generally comes across as a "great guy", and he did accept my criticism of the solution he'd given to a problem and produced a satisfactory alternative, but every point I made to him had to be explained in detail and I still felt at the end that he wouldn't get the solution 100% right when he incorporated it in his book.
One section of the book that I found absolutely fascinating was a short description of the standardization process of the Western or Gregorian calendar. It was mostly irrelevant to the topic of the book but fascinating nonetheless. There are other gems scattered throughout, he has a good list of references and I have found he has made several points which I could quote to support my postion in arguments in standards committee meetings, but I feel that it would take as much more effort to get the book right as it has take already to produce it.
Comment 8 people found this helpful. Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again
Report abuse

Most Recent Customer Reviews