| |
| |
Introduction | |
| |
| |
Organization of This Book | |
| |
| |
Feedback Needed! | |
| |
| |
Conventions | |
| |
| |
Acknowledgments | |
| |
| |
Example Data | |
| |
| |
Analytic Functions | |
| |
| |
CASE Expressions | |
| |
| |
Simple CASE Expressions | |
| |
| |
Searched CASE Expressions | |
| |
| |
Datatypes | |
| |
| |
Character String Types | |
| |
| |
Decimal Types | |
| |
| |
Binary Integer Types | |
| |
| |
Datetime Types | |
| |
| |
Dataype Conversion | |
| |
| |
Standard CAST Function | |
| |
| |
Standard EXTRACT Function | |
| |
| |
Datetime Conversions (Oracle) | |
| |
| |
Numeric Conversions (Oracle) | |
| |
| |
Datetime Conversions (DB2) | |
| |
| |
Numeric Conversions (DB2) | |
| |
| |
Datetime Conversions (SQL Server) | |
| |
| |
Numeric Conversions (SQL Server) | |
| |
| |
Datetime Conversions (MySQL) | |
| |
| |
Numeric Conversions (MySQL) | |
| |
| |
Datetime Conversions (PostgreSQL) | |
| |
| |
Numeric Conversions (PostgreSQL) | |
| |
| |
Deleting Data | |
| |
| |
Deleting in Order (MySQL) | |
| |
| |
Deleting All Rows | |
| |
| |
Deleting from Views and Subqueries | |
| |
| |
Returning Deleted Data (Oracle, DB2) | |
| |
| |
Double-FROM (SQL Server) | |
| |
| |
Functions | |
| |
| |
Datetime Functions (Oracle) | |
| |
| |
Datetime Functions (DB2) | |
| |
| |
Datetime Functions (SQL Server) | |
| |
| |
Datetime Functions (MySQL) | |
| |
| |
Datetime Functions (PostgreSQL) | |
| |
| |
Numeric and Math Functions (All Platforms) | |
| |
| |
Trigonometric Functions (All Platforms) | |
| |
| |
String Functions | |
| |
| |
Greatest and Least (Oracle, PostgreSQL) | |
| |
| |
Grouping and Summarizing | |
| |
| |
Aggregate Functions | |
| |
| |
Group by | |
| |
| |
Useful Group by Techniques | |
| |
| |
Having | |
| |
| |
Group by Extensions (Oracle, DB2) | |
| |
| |
Group by Extensions (SQL Server) | |
| |
| |
Hierarchical Queries | |
| |
| |
Recursive With (SQL Server, DB2) | |
| |
| |
Connect by (Oracle) | |
| |
| |
Indexes, Creating | |
| |
| |
Indexes, Removing | |
| |
| |
Inserting Data | |
| |
| |
Single-Row Inserts | |
| |
| |
Multi-Row Inserts (DB2, MySQL) | |
| |
| |
Insert Targets | |
| |
| |
Subquery Inserts | |
| |
| |
Returning Inserted Values (Oracle, DB2) | |
| |
| |
Multi-Table Inserts (Oracle) | |
| |
| |
Joining Tables | |
| |
| |
The Concept of a Join | |
| |
| |
Cross Joins | |
| |
| |
Inner Joins | |
| |
| |
The Using Clause (Oracle, MySQL, PostgreSQL) | |
| |
| |
Natural Joins (Oracle, MySQL, PostgreSQL) | |
| |
| |
Non-Equi-Joins | |
| |
| |
Outer Joins | |
| |
| |
Literals | |
| |
| |
Text Literals | |
| |
| |
Numeric Literals | |
| |
| |
Datetime Literals (Oracle, MySQL, PostgreSQL) | |
| |
| |
Datetime Interval Literals | |
| |
| |
Merging Data (Oracle, DB2) | |
| |
| |
Nulls | |
| |
| |
Predicates for Nulls | |
| |
| |
Using CASE with Nulls | |
| |
| |
Using the Coalesce Function | |
| |
| |
Functions for Nulls (Oracle) | |
| |
| |
Functions for Nulls (DB2) | |
| |
| |
Functions for Nulls (SQL Server) | |
| |
| |
Functions for Nulls (MySQL) | |
| |
| |
Functions for Nulls (PostgreSQL) | |
| |
| |
OLAP Functions | |
| |
| |
Predicates | |
| |
| |
Exists Predicates | |
| |
| |
In Predicates | |
| |
| |
Between Predicates | |
| |
| |
Like Predicates | |
| |
| |
Recursive Queries | |
| |
| |
Regular Expressions | |
| |
| |
Regular Expressions (Oracle) | |
| |
| |
Regular Expressions (SQL Server) | |
| |
| |
Regular Expressions (MySQL) | |
| |
| |
Regular Expressions (PostgreSQL) | |
| |
| |
Selecting Data | |
| |
| |
The Select Clause | |
| |
| |
All and Distinct | |
| |
| |
The From Clause | |
| |
| |
The Where Clause | |
| |
| |
The Group by Clause | |
| |
| |
The Having Clause | |
| |
| |
The Order by Clause | |
| |
| |
Subqueries | |
| |
| |
The With Clause (Oracle, SQL Server, DB2) | |
| |
| |
Tables, Creating | |
| |
| |
Creating a Table (Oracle) | |
| |
| |
Creating a Table (DB2) | |
| |
| |
Creating a Table (SQL Server) | |
| |
| |
Creating a Table (MySQL) | |
| |
| |
Creating a Table (PostgreSQL) | |
| |
| |
Tables, Modifying | |
| |
| |
Modifying a Table (Oracle) | |
| |
| |
Modifying a Table (DB2) | |
| |
| |
Modifying a Table (SQL Server) | |
| |
| |
Modifying a Table (MySQL) | |
| |
| |
Modifying a Table (PostgreSQL) | |
| |
| |
Tables, Removing | |
| |
| |
Transaction Management | |
| |
| |
Autocommit Mode (SQL Server, MySQL, PostgreSQL) | |
| |
| |
Starting a Transaction | |
| |
| |
Ending a Transaction | |
| |
| |
Aborting a Transaction | |
| |
| |
Aborting to a Transaction Savepoint | |
| |
| |
Union Queries | |
| |
| |
Union and Union All | |
| |
| |
Order by in Union Queries | |
| |
| |
Names and Datatypes in a Union | |
| |
| |
Order of Evaluation | |
| |
| |
Except (or Minus) | |
| |
| |
Intersect | |
| |
| |
Updating Data | |
| |
| |
Simple Updates | |
| |
| |
New Values from a Subquery | |
| |
| |
Updating Views and Subqueries | |
| |
| |
Update From Clause (SQL Server, PostgreSQL) | |
| |
| |
Returning Updated Data (Oracle, DB2) | |
| |
| |
Window Functions | |
| |
| |
Defining a Summary Window (Oracle, DB2, SQL Server) | |
| |
| |
Ordering and Ranking Within a Window (Oracle, DB2, SQL Server) | |
| |
| |
Comparing Values Across Rows (Oracle) | |
| |
| |
Summarizing over a Moving Window (Oracle, DB2) | |
| |
| |
Window Function Syntax (Oracle) | |
| |
| |
Window Function Syntax (DB2) | |
| |
| |
Window Function Evaluation and Placement | |
| |
| |
Index | |