Home Page Icon
Home Page
Table of Contents for
Dedication
Close
Dedication
by Sandra L. Emerson, Marcy Darnovsky, Judith S. Bowman
Practical SQL Handbook, The: Using SQL Variants, Fourth Edition
Copyright
Dedication
List of Figures
Foreword to the Fourth Edition
Preface
Why New Editions?
Changes for Recent Editions
The Fourth Edition
Acknowledgments
Introduction
The Beginnings of SQL
The Commercialization of SQL
Who Should Use This Book
The Focus of This Book
How to Learn SQL with This Book
SQL and Relational Database Management
Relational Database Management
The Relational Model: It's All Tables
Independence Forever
A High-Level Language
Data Manipulation
Data Definition
Data Administration
Relational Operations
Projection
Selection
Join
Alternatives for Viewing Data
NULLs
Security
Integrity
SQL Functions
Summary
Designing Databases
Design Considerations
Do You Need an Expert?
Data Definition and Customization
How to Approach Database Design
Introducing the Sample Database
Data Entities and Relationships
Entities: Things with an Independent Existence
One-to-Many Relationships
Many-to-Many Relationships
One-to-One Relationships
The Entity-Relationship Approach Summarized
The Normalization Guidelines
First Normal Form
Second Normal Form
Third Normal Form
Fourth Normal Form
Reviewing the Database Design
Summarizing the bookbiz Database
Testing Your Database Design
Other Database Definition Considerations
Summary
Creating and Filling a Database
From Theory to Practice: Installing bookbiz
Distinguishing SQL Examples and Syntax
Coping with Failure
Working with Databases
Getting Started
Recognizing Roles
Reserving Space for Database Objects
Choosing Databases
Creating Simple Tables
Choosing Datatypes
Assigning NULL and NOT NULL
Planning Tables
Defining the Tables in bookbiz
Creating Indexes
The CREATE INDEX Statement
How, What, and Why to Index
Creating Tables With SQL-92 Constraints
Sketching Constraints
Implementing Constraints on Individual Columns
Implementing Multicolumn Constraints
Changing and Deleting Databases and Objects
Changing Databases
Changing Table Definitions
Removing Databases
Removing Tables
Removing Indexes
Adding, Changing, and Removing Data
Adding New Rows: INSERT
Changing Existing Data: UPDATE
Removing Data: DELETE
Summary
Selecting Data from the Database
SELECT Overview and Syntax
Basic SELECT Syntax
Full SELECT Syntax
Choosing Columns: The SELECT Clause
Choosing All Columns: SELECT *
Choosing Specific Columns
More Than Column Names
Specifying Tables: The FROM Clause
Using Table Aliases
Skipping FROM
Selecting Rows: The WHERE Clause
Comparison Operators
Connecting Conditions with Logical Operators
Ranges (BETWEEN and NOT BETWEEN)
Lists (IN and NOT IN)
Selecting Null Values
Matching Character Strings: LIKE
Like, Is IN LIKE Equals . . . ?
Summary
Sorting Data and Other Selection Techniques
A New Batch of SELECT Statement Clauses
Sorting Query Results: ORDER BY
ORDER BY Syntax
Character Sets and Sort Orders
Sorts Within Sorts
Sort Up, Sort Down
What About More Complex Expressions?
How Do You Sort Nulls?
Eliminating Duplicate Rows: DISTINCT and ALL
DISTINCT Syntax
DISTINCT with Multiple SELECT List Items
Aggregate Functions
Aggregate Syntax
Summary
Grouping Data and Reporting from It
Grouping and Aggregates
The GROUP BY Clause
GROUP BY Syntax
Cautions and Restrictions
NULLs and Groups
GROUP BY: Aggregate Interactions
GROUP BY with WHERE
GROUP BY and ORDER BY
The HAVING Clause
Garden-Variety HAVING
WHERE, GROUP BY, HAVING, ORDER BY
All About NULLs
NULLs and Database Design
Comparisons Involving NULLs
NULLs and Computations
Defaults as Alternatives to NULLs
Functions That Work with NULLs
NULL Functions and “What-If” Calculations
Summary
Joining Tables for Comprehensive Data Analysis
Defining Joins
Why Joins Are Necessary
Associating Data from Separate Tables
Providing Flexibility
Getting a Good Join
FROM/WHERE Join Syntax
SQL-92 Join Syntax
Analyzing a Join
Improving the Readability of Join Results
Avoiding Duplication
Limiting the Width of the Display
Using Aliases in the FROM Clause Table/View List
Specifying Join Conditions
Joins Based on Equality
Joins Not Based on Equality
Joining More Than Two Tables
Exploring Exotic Joins
Joining a Table with Itself: The Self-Join
Showing the Background: Outer Joins
Avoiding a Common Source of Errors
Understanding the Cartesian Product
Using the Cartesian Product
Constraining the Cartesian Product
Going Beyond Joins: UNION, INTERSECT, MINUS
UNION
INTERSECT and MINUS
Summary
Structuring Queries with Subqueries
What Is a Subquery?
Simplified Subquery Syntax
How Do Subqueries Work?
Simple Subquery Processing
Correlated Subquery Processing
Simple-Correlated Performance Issues
Joins or Subqueries?
Subqueries!
Joins!
Subqueries vs. Self-Joins?
Which Is Better?
Subquery Rules
Subqueries Returning Zero or More Values
Subqueries Introduced with IN
Subqueries Introduced with NOT IN
Correlated Subqueries Introduced with IN
Subqueries Introduced with Comparison Operators and ANY or ALL
Subqueries Returning a Single Value
Aggregate Functions Guarantee a Single Value
GROUP BY and HAVING Must Return a Single Value
Correlated Subqueries with Comparison Operators
Subqueries Testing Existence
NOT EXISTS Seeks the Empty Set
Using EXISTS to Find Intersection and Difference
EXISTS Alternatives
Subqueries in Multiple Levels of Nesting
Subqueries in UPDATE, DELETE, and INSERT Statements
Subqueries in FROM and SELECT Clauses
Subqueries in the FROM Clause
Subqueries in the SELECT Clause
Summary
Creating and Using Views
With a View Toward Flexibility
View Commands
Creating Views
Displaying Data Through Views
Dropping Views
Advantages of Views
Focus, Simplification, and Customization
Security
Independence
How Views Work
Naming View Columns
Creating Views with Multiple Underlying Objects
Resolving Views
Data Modification Through Views
The Rules According to ANSI
Creating Copies of Data
Summary
Security, Transactions, Performance, and Integrity
Database Management in the Real World
Data Security
User Identification and Special Users
The GRANT and REVOKE Commands
Views as Security Mechanisms
Transactions
Transactions and Concurrency
Transactions and Recovery
User-Defined Transactions
Performance
Benchmarking
Design and Indexing
Optimizing Queries
Other Tools for Monitoring and Boosting Performance
Data Integrity
Domain Constraints
Entity Integrity
Referential Integrity
Stored Procedures and Triggers
Summary
Solving Business Problems
Using SQL on the Job
Thinking Conditionally
CASE/DECODE
Changing Null Displays
Formatting and Displaying Data
Displaying One Column as Two
Displaying Two Columns as One
Converting from One Datatype to Another
Playing with Patterns
Matching Uppercase and Lowercase Letters
Finding Data Within a Range When You Don't Know the Values
Locating Date Data
Displaying Data by Time Units
Avoiding Mistakes
Distinguishing DISTINCTs
Removing Duplicates
Finding the “First” Entry
Summary
Syntax Summary for the SQL Used in This Book
Formatting
Syntax Conventions
Statement List
Industry SQL Equivalents
Comparisons
Naming Convention Comparison
Datatype Comparison
Function Comparison
Character Functions
Conditional Functions
Date and Time Functions
Glossary
The bookbiz Sample Database
Database Details
Table Charts
publishers Table
authors Table
titles Table
titleauthors Table
sales Table
salesdetails Table
editors Table
titleditors Table
roysched Table
CREATE Statements for the bookbiz Database
Adaptive Server Anywhere CREATEs
Transact-SQL CREATEs
Oracle CREATEs
Informix CREATEs
INSERT Statements
CREATE VIEW Statements
Resources
Books
General
Informix
Microsoft SQL Server
mSQL/MySQL
Oracle
Sybase
Transact-SQL
Web Sites
Newsgroups
CD ROM Warranty
Using the Practical SQL Handbook CD
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Copyright
Next
Next Chapter
List of Figures
Dedication
To our mothers: Mary Jo Coogan Bowman, Alma E. Emerson, Betty Schwarcz
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset