SQL Pocket Guide

SQL Pocket Guide

by Jonathan Gennick
SQL Pocket Guide

SQL Pocket Guide

by Jonathan Gennick

eBook

$10.49  $11.99 Save 13% Current price is $10.49, Original price is $11.99. You Save 13%.

Available on Compatible NOOK devices, the free NOOK App and in My Digital Library.
WANT A NOOK?  Explore Now

Related collections and offers


Overview

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 (includingthe free Oracle Database 10g Express Edition (XE))
  • Microsoft SQL Server 2005
  • MySQL 5
  • IBM DB2 8.2
  • PostreSQL 8.1 database

Product Details

ISBN-13: 9780596554538
Publisher: O'Reilly Media, Incorporated
Publication date: 04/17/2006
Series: Pocket Reference (O'Reilly)
Sold by: Barnes & Noble
Format: eBook
Pages: 192
File size: 4 MB

About the Author

Jonathan Gennick is an SQL aficionado who writes extensively on the SQL language and other database topics. He is the author of several books, and also a number of articles in Oracle Magazine. He is currently a book editor focusing on database titles, primarily involving Oracle and SQL Server.

Table of Contents

Introduction1
Organization of This Book2
Feedback Needed!2
Conventions3
Acknowledgments4
Example Data4
Analytic Functions6
CASE Expressions6
Simple CASE Expressions6
Searched CASE Expressions6
Datatypes7
Character String Types7
Decimal Types8
Binary Integer Types8
Datetime Types9
Dataype Conversion11
Standard CAST Function1
Standard EXTRACT Function12
Datetime Conversions (Oracle)12
Numeric Conversions (Oracle)16
Datetime Conversions (DB2)17
Numeric Conversions (DB2)20
Datetime Conversions (SQL Server)21
Numeric Conversions (SQL Server)25
Datetime Conversions (MySQL)26
Numeric Conversions (MySQL)30
Datetime Conversions (PostgreSQL)31
Numeric Conversions (PostgreSQL)33
Deleting Data35
Deleting in Order (MySQL)35
Deleting All Rows36
Deleting from Views and Subqueries37
Returning Deleted Data (Oracle, DB2)37
Double-FROM (SQL Server)38
Functions39
Datetime Functions (Oracle)39
Datetime Functions (DB2)42
Datetime Functions (SQL Server)43
Datetime Functions (MySQL)44
Datetime Functions (PostgreSQL)45
Numeric and Math Functions (All Platforms)48
Trigonometric Functions (All Platforms)50
String Functions50
Greatest and Least (Oracle, PostgreSQL)55
Grouping and Summarizing56
Aggregate Functions56
Group by57
Useful Group by Techniques59
Having60
Group by Extensions (Oracle, DB2)61
Group by Extensions (SQL Server)64
Hierarchical Queries65
Recursive With (SQL Server, DB2)66
Connect by (Oracle)68
Indexes, Creating74
Indexes, Removing74
Inserting Data75
Single-Row Inserts75
Multi-Row Inserts (DB2, MySQL)76
Insert Targets76
Subquery Inserts76
Returning Inserted Values (Oracle, DB2)77
Multi-Table Inserts (Oracle)78
Joining Tables80
The Concept of a Join80
Cross Joins81
Inner Joins82
The Using Clause (Oracle, MySQL, PostgreSQL)83
Natural Joins (Oracle, MySQL, PostgreSQL)84
Non-Equi-Joins85
Outer Joins86
Literals89
Text Literals90
Numeric Literals92
Datetime Literals (Oracle, MySQL, PostgreSQL)92
Datetime Interval Literals93
Merging Data (Oracle, DB2)93
Nulls96
Predicates for Nulls96
Using CASE with Nulls96
Using the Coalesce Function97
Functions for Nulls (Oracle)97
Functions for Nulls (DB2)98
Functions for Nulls (SQL Server)98
Functions for Nulls (MySQL)99
Functions for Nulls (PostgreSQL)100
OLAP Functions100
Predicates100
Exists Predicates101
In Predicates102
Between Predicates102
Like Predicates103
Recursive Queries104
Regular Expressions104
Regular Expressions (Oracle)104
Regular Expressions (SQL Server)108
Regular Expressions (MySQL)108
Regular Expressions (PostgreSQL)110
Selecting Data115
The Select Clause115
All and Distinct120
The From Clause121
The Where Clause124
The Group by Clause124
The Having Clause124
The Order by Clause125
Subqueries126
The With Clause (Oracle, SQL Server, DB2)127
Tables, Creating130
Creating a Table (Oracle)130
Creating a Table (DB2)132
Creating a Table (SQL Server)133
Creating a Table (MySQL)133
Creating a Table (PostgreSQL)134
Tables, Modifying135
Modifying a Table (Oracle)135
Modifying a Table (DB2)136
Modifying a Table (SQL Server)137
Modifying a Table (MySQL)138
Modifying a Table (PostgreSQL)139
Tables, Removing140
Transaction Management141
Autocommit Mode (SQL Server, MySQL, PostgreSQL)141
Starting a Transaction142
Ending a Transaction146
Aborting a Transaction147
Aborting to a Transaction Savepoint148
Union Queries148
Union and Union All149
Order by in Union Queries150
Names and Datatypes in a Union150
Order of Evaluation151
Except (or Minus)152
Intersect153
Updating Data155
Simple Updates155
New Values from a Subquery156
Updating Views and Subqueries157
Update From Clause (SQL Server, PostgreSQL)157
Returning Updated Data (Oracle, DB2)158
Window Functions158
Defining a Summary Window (Oracle, DB2, SQL Server)159
Ordering and Ranking Within a Window (Oracle, DB2, SQL Server)160
Comparing Values Across Rows (Oracle)162
Summarizing over a Moving Window (Oracle, DB2)164
Window Function Syntax (Oracle)164
Window Function Syntax (DB2)165
Window Function Evaluation and Placement166
Index167
From the B&N Reads Blog

Customer Reviews