Table Of ContentPreface Introduction 1 Database Design 2 Normalization 3 Numeric Data in SQL 4 Temporal Datatypes in SQL 5 Character Datatypes in SQL 6 NULLs-Missing Data in SQL 7 Other Expressions 8 Other Schema Objects 9 Table Operations 10 Comparison or Theta Operators 11 Valued Predicates 12 LIKE and SIMILAR Predicates 13 BETWEEN and OVERLAPS Predicates 14 The [NOT] IN Predicate 15 EXISTS ( ) Predicate 16 Quantified Subquery Predicate 17 The SELECT Statements Conditional OUTER JOINs 18 VIEWs and TEMPORARY TABLEs 19 Partitioning Data 20 Grouping Operations 21 Aggregate Functions 22 Auxiliary Tables 23 Statistics in SQL 24 Regions, Runs and Sequences 25 Array Structures in SQL 26 Set Operations 27 Subsets 28 Adjacency List Model of Trees in SQL 29 Nested Set Model of Trees in SQL 30 Graphs in SQL 31 Optimizing Code Appendix: Readings and Resources References Index About the Author
SynopsisSQL 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., 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.