SQL Pocket Guide

Paperback
from $0.00

Author: Jonathan Gennick

ISBN-10: 0596526881

ISBN-13: 9780596526887

Category: Applications & Languages - Databases

Search in google:

SQL is the language of databases. It's used to create and maintain database objects, place data into those objects, query the data, modify the data, and, finally, delete data that is no longer needed. Databases lie at the heart of many, if not most business applications. Chances are very good that if you're involved with software development, you're using SQL to some degree. And if you're using SQL, you should own a good reference or two. Now available in an updated second edition, our very popular SQL Pocket Guide is a major help to programmers, database administrators, and everyone who uses SQL in their day-to-day work. The SQL Pocket Guide is a concise reference to frequently used SQL statements and commonly used SQL functions. Not just an endless collection of syntax diagrams, this portable guide addresses the language's complexity head on and leads by example. The information in this edition has been updated to reflect the latest versions of the most commonly used SQL variants including: Oracle Database 10g, Release 2 (including the free Oracle Database 10g Express Edition (XE)) Microsoft SQL Server 2005 MySQL 5 IBM DB2 8.2 PostreSQL 8.1 database

Introduction1Organization of This Book2Feedback Needed!2Conventions3Acknowledgments4Example Data4Analytic Functions6CASE Expressions6Simple CASE Expressions6Searched CASE Expressions6Datatypes7Character String Types7Decimal Types8Binary Integer Types8Datetime Types9Dataype Conversion11Standard CAST Function1Standard EXTRACT Function12Datetime Conversions (Oracle)12Numeric Conversions (Oracle)16Datetime Conversions (DB2)17Numeric Conversions (DB2)20Datetime Conversions (SQL Server)21Numeric Conversions (SQL Server)25Datetime Conversions (MySQL)26Numeric Conversions (MySQL)30Datetime Conversions (PostgreSQL)31Numeric Conversions (PostgreSQL)33Deleting Data35Deleting in Order (MySQL)35Deleting All Rows36Deleting from Views and Subqueries37Returning Deleted Data (Oracle, DB2)37Double-FROM (SQL Server)38Functions39Datetime Functions (Oracle)39Datetime Functions (DB2)42Datetime Functions (SQL Server)43Datetime Functions (MySQL)44Datetime Functions (PostgreSQL)45Numeric and Math Functions (All Platforms)48Trigonometric Functions (All Platforms)50String Functions50Greatest and Least (Oracle, PostgreSQL)55Grouping and Summarizing56Aggregate Functions56Group by57Useful Group by Techniques59Having60Group by Extensions (Oracle, DB2)61Group by Extensions (SQL Server)64Hierarchical Queries65Recursive With (SQL Server, DB2)66Connect by (Oracle)68Indexes, Creating74Indexes, Removing74Inserting Data75Single-Row Inserts75Multi-Row Inserts (DB2, MySQL)76Insert Targets76Subquery Inserts76Returning Inserted Values (Oracle, DB2)77Multi-Table Inserts (Oracle)78Joining Tables80The Concept of a Join80Cross Joins81Inner Joins82The Using Clause (Oracle, MySQL, PostgreSQL)83Natural Joins (Oracle, MySQL, PostgreSQL)84Non-Equi-Joins85Outer Joins86Literals89Text Literals90Numeric Literals92Datetime Literals (Oracle, MySQL, PostgreSQL)92Datetime Interval Literals93Merging Data (Oracle, DB2)93Nulls96Predicates for Nulls96Using CASE with Nulls96Using the Coalesce Function97Functions for Nulls (Oracle)97Functions for Nulls (DB2)98Functions for Nulls (SQL Server)98Functions for Nulls (MySQL)99Functions for Nulls (PostgreSQL)100OLAP Functions100Predicates100Exists Predicates101In Predicates102Between Predicates102Like Predicates103Recursive Queries104Regular Expressions104Regular Expressions (Oracle)104Regular Expressions (SQL Server)108Regular Expressions (MySQL)108Regular Expressions (PostgreSQL)110Selecting Data115The Select Clause115All and Distinct120The From Clause121The Where Clause124The Group by Clause124The Having Clause124The Order by Clause125Subqueries126The With Clause (Oracle, SQL Server, DB2)127Tables, Creating130Creating a Table (Oracle)130Creating a Table (DB2)132Creating a Table (SQL Server)133Creating a Table (MySQL)133Creating a Table (PostgreSQL)134Tables, Modifying135Modifying a Table (Oracle)135Modifying a Table (DB2)136Modifying a Table (SQL Server)137Modifying a Table (MySQL)138Modifying a Table (PostgreSQL)139Tables, Removing140Transaction Management141Autocommit Mode (SQL Server, MySQL, PostgreSQL)141Starting a Transaction142Ending a Transaction146Aborting a Transaction147Aborting to a Transaction Savepoint148Union Queries148Union and Union All149Order by in Union Queries150Names and Datatypes in a Union150Order of Evaluation151Except (or Minus)152Intersect153Updating Data155Simple Updates155New Values from a Subquery156Updating Views and Subqueries157Update From Clause (SQL Server, PostgreSQL)157Returning Updated Data (Oracle, DB2)158Window Functions158Defining a Summary Window (Oracle, DB2, SQL Server)159Ordering and Ranking Within a Window (Oracle, DB2, SQL Server)160Comparing Values Across Rows (Oracle)162Summarizing over a Moving Window (Oracle, DB2)164Window Function Syntax (Oracle)164Window Function Syntax (DB2)165Window Function Evaluation and Placement166Index167