SQL Clearly Explained book cover

SQL Clearly Explained

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.


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.

Paperback, 480 Pages

Published: April 2010

Imprint: Morgan Kaufmann

ISBN: 978-0-12-375697-8


  • "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


  • Part I: Introduction

    Chapter 1: The Relational Data Model

    Schemas and Entities

    Relations and Tables

    Representing Relationships


    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






    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


    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


    Part III: Managing Database Structure

    Chapter 9: Schemas and Tables

    Database Object Hierarchy





    Determining When Constraints are Checked

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


    Temporary Tables

    Common Table Expressions (CTEs)


    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


    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


    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


    Part VI: Appendices

    Appendix A: Common Acronyms and Abbreviations

    Appendix B: SQLSTATE Return Codes

    Appendix C: SQL Syntax Summary




advert image