The primary source of information for relational databases is the documentation and help files provided by the vendors themselves. While each vendor's documentation is an indispensable resource that most database programmers and database administrators turn to first, this documentation has a number of limitations:
In other words, the documentation included with a vendor's database provides an exhaustive explanation of every aspect of that particular vendor's platform. This is only natural; after all, help texts are geared toward delivering the main facts about a product. They'll tell you a command's specific syntax (and all its obscure variants) and, in general terms, how to implement it. However, if you move between RDBMSs and you need to be productive very quickly, you will rarely use those obscure command variations; instead, you'll utilize the capabilities most common in real-life situations.
This book begins where the vendor documentation ends by distilling the experiences of professional database administrators and developers who have used these SQL variants day in and day out to support complex enterprise applications. It offers you the benefit of their experience in a compact and easily usable format. Whether SQL is new to you or you have been using SQL since its earliest days, there are always new tips and techniques to learn. And when you're moving between different implementations, it's always important to find out about the issues that can bite you if you're not careful and informed.
Who Should Read This Book?
SQL in a Nutshell , Third Edition, benefits several groups of users. It will be useful for programmers who require a concise and handy SQL reference tool; for developers who need to migrate from one SQL dialect to another; and for database administrators (DBAs) who need to both execute a myriad of SQL statements to keep their enterprise databases up and running, and create and manage objects such as tables, indexes, and views.
This book is a reference work, not a tutorial. The writing is not expository. For example, we won't explain the concept of an elementary loop. Experienced developers already know such thingsyou want the meat. So we will explain, for example, the detailed workings of an ANSI standard cursor, how it works on each of the database platforms we cover, the special capabilities of cursors on each database platform, and the various pitfalls of cursors and how to get around them.
While we don't intend for SQL in a Nutshell , Third Edition, to be a tutorial on SQL or a handbook for database design, we do provide some brief coverage of introductory topics, and we hope you'll find that helpful. provide a concise introduction to SQL, covering the general origins, essential structure, and basic operation of the language. If you're new to SQL, these chapters will help you get started.
How This Book Is Organized
SQL in a Nutshell , Third Edition, is divided into four chapters and one appendix:
Discusses the relational database model, describes the current and previous SQL standards, and introduces the SQL implementations covered in this book.
Describes the fundamental concepts necessary for understanding relational databases and SQL commands.
Provides an alphabetical command reference to SQL statements. This chapter details the latest ANSI standard (SQL3) for each command, as well as the implementation of each command by MySQL, Oracle, PostgreSQL, and SQL Server.
Provides an alphabetical reference of the ANSI SQL3 functions, describing vendor implementations of all SQL3 functions. In addition, this chapter includes coverage of all platform-specific functions that are unique to each implementation.
Provides a table of keywords declared in SQL3 and by the different database platforms. You can use this table to look for words that you should not use for object or variable names.
How to Use This Book
SQL in a Nutshell , Third Edition, is primarily a command reference. As a consequence, you'll probably use it to look up a variety of SQL commands and functions. However, with documentation for the ANSI standard itself plus four database platforms, the description for each command has the potential to get very large.
In order to reduce the verbiage describing each command, we compare each platform's implementation to the SQL3 standard. If the platform supports a clause described in the SQL3 discussion, we won't repeat that clause again.
Generic and transportable examples are provided within the body of each SQL3 command description. Since the SQL3 standard is ahead of most database platforms, examples aren't provided for elements of the SQL3 commands that are not supported by any platform discussed in this book. In addition, more examples are provided for each database platform that highlight unique extensions and enhancements, of which there are many.