Joe Celkos SQL for Smarties: Advanced SQL Programming offers tips and techniques in advanced programming. This book is the fourth edition and it consists of 39 chapters, starting with a comparison between databases and file systems. It covers transactions and currency control, schema level objects, locating data and schema numbers, base tables, and auxiliary tables. Furthermore, procedural, semi-procedural, and declarative programming are explored in this book. The book also presents the different normal forms in database normalization, including the first, second, third, fourth, fifth, elementary key, domain-key, and Boyce-Codd normal forms. It also offers practical hints for normalization and denormalization. The book discusses different data types, such as the numeric, temporal and character data types; the different predicates; and the simple and advanced SELECT statements. In addition, the book presents virtual tables, and it discusses data partitions in queries; grouping operations; simple aggregate functions; and descriptive statistics, matrices and graphs in SQL. The book concludes with a discussion about optimizing SQL. It will be of great value to SQL programmers.

Key Features


  • Expert advice from a noted SQL authority and award-winning columnist who has given ten years service to the ANSI SQL standards committee
  • Teaches scores of advanced techniques that can be used with any product, in any SQL environment, whether it is an SQL 92 or SQL 2008 environment
  • Offers tips for working around deficiencies and gives insight into real-world challenges


This book is intended for working SQL programmers, database administrators, database designers, database analysts, and application system developers as well as those who are developing new features for database management systems who want to know about user needs. This would include anyone working with electronic content in the relational database context but also XML. Web services, etc.

Table of Contents


Chapter 1: Databases versus File Systems

Chapter 2: Transactions and Concurrency Control

Chapter 3: Schema Level Objects

Chapter 4: Locating Data and Special Numbers

Chapter 5: Base Tables and Related Elements

Chapter 6: Procedural, Semi-Procedural and Declarative Programming

Chapter 7: Procedural Constructs

Chapter 8: Auxiliary Tables

Chapter 9: Normalization

Chapter 10: Numeric Data Types

Chapter 11: Temporal Data Types

Chapter 12: Character Data Types

Chapter 13: NULLs -- Missing Data in SQL

Chapter 14: Multiple Column Data Elements

Chapter 15: Table Operations

Chapter 16: Comparison or Theta Operators

Chapter 17: Valued Predicates

Chapter 18: CASE Expressions

Chapter 19: LIKE and SIMILAR TO Predicates

Chapter 20: BETWEEN and OVERLAPS Predicates

Chapter 21: The [NOT] IN() Predicate

Chapter 22: EXISTS() Predicate

Chapter 23: Quantified Subquery Predicates

Chapter 24: The Simple SELECT Statement

Chapter 25: Advanced SELECT Statements

Chapter 26: Virtual Tables: VIEWs, Derived Tables, CTEs and MQTs

Chapter 27: Partitioning Data in Queries

Chapter 28: Grouping Operations

Chapter 29: Simple Aggregate Functions

Chapter 30: Advanced Grouping, Windowed Aggregation and OLAP in SQL

Chapter 31: Descriptive Statistics in SQL

Chapter 32: Sub-Sequences, Regions, Runs, Gaps, and Islands

Chapter 33: Matrices in SQL

Chapter 34: Set Operations

Chapter 35: Subsets

Chapter 36: Trees and Hierarchies in SQL

Chapter 37: Graphs in SQL

Chapter 38: Temporal Queries

Chapter 39: Optimizing SQL


No. of pages:
© 2011
Morgan Kaufmann
eBook ISBN:
Print ISBN:

About the author

Joe Celko

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.

Affiliations and Expertise

Independent Consultant, Austin, Texas