Have one to sell? Sell yours here
Tell the Publisher!
I'd like to read this book on Kindle

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.
Sorry, this item is not available in
Image not available for
Color:
Image not available

To view this video download Flash Player

 

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

Joe Celko
4.3 out of 5 stars  See all reviews (27 customer reviews)


Available from these sellers.


Free Two-Day Shipping for College Students with Amazon Student

Shop the new tech.book(store)
New! Introducing the tech.book(store), a hub for Software Developers and Architects, Networking Administrators, TPMs, and other technology professionals to find highly-rated and highly-relevant career resources. Shop books on programming and big data, or read this week's blog posts by authors and thought-leaders in the tech industry. > Shop now

Book Description

October 25, 1999 1558605762 978-1558605763 1

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.


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.


Features




  • 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. He has written over 900 columns in the computer trade and academic press, mostly dealing with data and databases. Joe has authored eight books on SQL for Morgan Kaufmann.


Product Details

  • 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.3 out of 5 stars  See all reviews (27 customer reviews)
  • Amazon Best Sellers Rank: #502,180 in Books (See Top 100 in Books)

Customer Reviews

Most Helpful Customer Reviews
45 of 46 people found the following review helpful
4.0 out of 5 stars An absolute MUST for any serious SQL programmer February 14, 2000
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 | 
Was this review helpful to you?
158 of 179 people found the following review helpful
3.0 out of 5 stars I'm a little underwhelmed... January 11, 2002
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. What am I missing here? It was not explained to me in this book, it was just a blanket statement of preference, put across like a hard and fast rule.

But then come the contradictions. In the very next chapter on temporal data types, we get a very long paragraph on "key generators" and how they need to be designed to eliminate or minimize identical keys (I kid ye not!). He talks about elaborate hashing algorithms, the server system clock, random number generators, and how pseudorandom numbers are not usually a problem since the cycle size can be "hundreds of thousands or even millions of numbers". Huh? Amazon has 50,000,000 customers! I'm sure they wouldn't be too happy if "only" every millionth one had the same id! No mention in this entire section on GUID or UNIQUEIDENTIFIER, which won't repeat forever in the known universe!

Then there is seeming randomness to the topics introduced. I think I work with a guy that's a lot like Joe, but man, can it be hard to follow the "why" of what he is talking about! I usually figure it out about two days later when I'm sitting at my desk working on something completely different. Here's one example: We go from an incredibly long section on Domain Key Normal Form, with all of its calculus functional dependency stuff ("A determines B, therefore if CA = B, &c, &c, &c....."), to a paragraph right after this about normalization, and how a Students table should not have "Student data and also bowling scores". But come on, that's DB101, not Math335!

Bottom Line: The reason I gave three stars to this book is that I think I misread its intention. I believed it to be a book for someone who knew SQL, and wanted to become more advanced in SQL. Now that I ponder the title, however, I believe that it means "OK, here's a book for you scientific math types out there who want to apply your math degree to learn SQL", i.e., SQL for smarties, not for non-degreed dummies like myself. That, to me, is exactly how the book is written, and it probably succeeds against that yardstick.

Was this review helpful to you?
45 of 54 people found the following review helpful
1.0 out of 5 stars Full of academic exercises and toy examples May 27, 2001
By A Customer
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 | 
Was this review helpful to you?
Most Recent Customer Reviews
4.0 out of 5 stars Great selection for serious SQL users
Excellent book, filled with very clearly presented examples and concepts from general SQL programming. Read more
Published on July 19, 2005 by Merrill Aldrich
5.0 out of 5 stars Indispensible recipes for SQL success.
I needed to link to this book for a blog entry, and I was looking for my review of this book when I realized I never wrote one. Read more
Published on March 16, 2005 by Christopher Wanko
3.0 out of 5 stars Smarties or oldies?
I have browsed at this book in bookstores for years, always wondering if the info in it would be of use to me.

I write queries all day, in SQL Server, Sybase 5. Read more
Published on December 9, 2004 by Daniel Williams
4.0 out of 5 stars Be a SQL God
If you need to sling some really nasty SQL which you probably shouldn't be writing in the first place, then this book is for you. Celko is the man. Read more
Published on February 12, 2004 by Terry Smith
5.0 out of 5 stars Excellent Resource for Database Programmers
SQL for Smarties is a book that you should own if you work with relational databases. It has good practical advice and good examples. Read more
Published on November 2, 2003 by Steve Berczuk
5.0 out of 5 stars Excellent Resource for Database Programmers
SQL for Smarties is a book that yoo should own if you work with relational databases. It has good practical advice and good examples. Read more
Published on November 2, 2003 by Steve Berczuk
5.0 out of 5 stars Amazing
This book is one of the first references I have found on SQL that doesn't spend 75% of the book discussing simple Select, Update and Delete statements. Read more
Published on August 20, 2003 by K. Ruff
5.0 out of 5 stars Optimised SQL Ahoy!
This book has been marvellous for me. I've been dealing with large ERP databases for the last two years now and Joe has really helped me tune and optimise my SQL to get the best... Read more
Published on August 2, 2003 by Mark Ashworth
5.0 out of 5 stars SQL for Smarties
A nice programers reference, full of examples on how to do appl ication programing in sql. If you are a program uses SQL often you may find this helpful.
Published on June 13, 2003
5.0 out of 5 stars PERFECT for the real world
"The examples that come to mind are his organizational trees. Who cares about that?" I do! Our company has a hierarchical structure with imperfections. Read more
Published on February 18, 2003
Search Customer Reviews
Only search this product's reviews





Sell a Digital Version of This Book in the Kindle Store

If you are a publisher or author and hold the digital rights to a book, you can sell a digital version of it in our Kindle Store. Learn more

Forums

Search Customer Discussions
Search all Amazon discussions

Topic From this Discussion
source code? Be the first to reply
Why are the reviews for all editions lumped together?
I have the first edition of the book and, if there are any typos, I didn't find them. However, given the number of complaints about typos I would have to believe that the later editions are different, at least in that respect.
Jan 17, 2008 by P. Vogel |  See all 2 posts
Start a new discussion
Topic:
First post:
Prompts for sign-in
 




So You'd Like to...


Create a guide


Look for Similar Items by Category