SQL Clearly Explained

By

  • Jan Harrington, Professor and Department Chair, Computer Science, Marist College, Hyde Park, New York, U.S.A.

SQL Explained, Third Edition, provides an in-depth introduction to using SQL (Structured Query Language). Readers will learn not only SQL syntax, but also how SQL works. Understanding the how as well as the what will aid in creating SQL statements that execute as quickly as possible. The book is organized into five parts. Part I presents the theoretical material underlying relational databases and SQL. Part II covers interactive SQL retrieval. Part III discusses the creation and management of database structure. It also covers non-data elements in the database environment, such as managing users/user accounts and transaction control. Part IV introduces several techniques for SQL programming: embedded SQL (using a high-level host language), dynamic SQL, and triggers/stored procedures. Part V discusses the non-relational extensions that have been added to the SQL standard: XML and object-relational capabilities. It covers object-oriented concepts, including the differences between pure object-oriented databases and object-relational databases. It also looks at SQL's object-relational features.
View full description

Audience

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.

 

Book information

  • Published: April 2010
  • Imprint: MORGAN KAUFMANN
  • ISBN: 978-0-12-375697-8

Reviews

"This book functions as a very good tutorial, taking you from the basics through expert topics in a very straightforward manner."--Bill Arledge, Consulting DB2 Product Manager

"SQL Clearly Explained is one of those rare books that delivers 100 percent what its title promises. If you need to use SQL on the job, and who doesn't, then this book should be on your desk."--Craig S. Mullins, DB2 Consultant and IBM Information Champion, Mullins Consulting, Inc.

"This book is of great value to SQL practitioners. It also makes an excellent college-level text."--Rudy Limeback, SQL Consultant, r937.com




Table of Contents


Part I: Introduction

Chapter 1: The Relational Data Model

Schemas and Entities

Relations and Tables

Representing Relationships

Views

The Design of the Sample Database

Chapter 2: Relational Algebra

Making Vertical Subsets: Project

Making Horizontal Subsets: Restrict

Choosing Columns and Rows: Restrict and Then Project

Union

Join

Difference

Intersect

Divide

Chapter 3: Introduction to SQL

A Bit of SQL History

Conformance Levels

SQL Environments

Elements of a SQL Statement

Part II: Interactive SQL

Chapter 4: Simple SQL Retrieval

Choosing Columns

Ordering the Result Table

Choosing Rows

Nulls and Retrieval: Three-Valued Logic

Chapter 5: Retrieving Data From More Than One Table

SQL Syntax for Inner Joins

Finding Multiple Rows in One Table: Joining a Table to Itself

Outer Joins

Table Constructors in Queries

Avoiding Joins with Uncorrelated Subqueries

Chapter 6: Advanced Retrieval Operations

Union

Negative Queries

The EXISTS Operator

The INTERSECT Operator

Performing Arithmetic

String Manipulation

Date and Time Manipulation

CASE Expressions

Chapter 7: Working with Groups of Rows

Set Functions

Changing Data Types: CAST

Grouping Queries

Windowing and Window Functions

Chapter 8: Data Modification

Inserting Rows

Updating Data

Deleting Rows

MERGE

Part III: Managing Database Structure

Chapter 9: Schemas and Tables

Database Object Hierarchy

Schemas

Domains

Tables

Assertions

Determining When Constraints are Checked

Chapter 10: Views, Temporary Tables, CTEs, and Indexes

Views

Temporary Tables

Common Table Expressions (CTEs)

Indexes

Chapter 11: Keeping the Design Up to Date

Modifying Tables

Modifying Domains

Deleting Database Elements

Chapter 12: Users and Access Rights

Managing User Accounts

Granting and Revoking Access Rights

Roles

Chapter 13: Users, Sessions, and Transaction Control

The Concurrent Use Data Environment

Database Sessions and Connections

Transaction Control

Part IV: SQL Programming

Chapter 14: Writing and Executing SQL Routines and Modules-Triggers and Stored Procedures

SQL Programming Elements

Executing Modules as Triggers

Executing Modules as Stored Procedures

Chapter 15: Embedded SQL

The Embedded SQL Environment

Using Host Language Variables

DBMS Return Codes

Retrieving a Single Row

Retrieving Multiple Rows: Cursors

Embedded SQL Data Modification

Chapter 16: Dynamic SQL

Immediate Execution

Dynamic SQL with Dynamic Parameters

Part V: Non-Relational SQL Extensions

Chapter 17: XML Support

XML Basics

SQL/XML

The XML Data Type

Chapter 18: The Object-Relational Data Model

Getting Started: Object-Orientation Without Computing

Basic OO Concepts

Benefits of Object-Orientation

Pure Object-Oriented Databases

The Object-Relational Data Model

Chapter 19: Object-Relational Support

An Additional Sample Database

SQL Data Types for Object-Relational Support

User-Defined Data Types and Typed Tables

Methods

Part VI: Appendices

Appendix A: Common Acronyms and Abbreviations

Appendix B: SQLSTATE Return Codes

Appendix C: SQL Syntax Summary

Glossary

Index