SQL, Third Edition (Visual QuickStart Guide Series) / Edition 3
  • Alternative view 1 of SQL, Third Edition (Visual QuickStart Guide Series) / Edition 3
  • Alternative view 2 of SQL, Third Edition (Visual QuickStart Guide Series) / Edition 3

SQL, Third Edition (Visual QuickStart Guide Series) / Edition 3

5.0 1
by Chris Fehily

View All Available Formats & Editions

ISBN-10: 0321553578

ISBN-13: 9780321553577

Pub. Date: 06/13/2008

Publisher: Peachpit Press

SQL is a standard interactive and programming language for querying and modifying data and managing databases. This task-based tutorial and reference guide takes the mystery out learning and applying SQL. After going over the relational database model and SQL syntax in the first few chapters, veteran author Chris Fehily immediately launches into the tasks that will


SQL is a standard interactive and programming language for querying and modifying data and managing databases. This task-based tutorial and reference guide takes the mystery out learning and applying SQL. After going over the relational database model and SQL syntax in the first few chapters, veteran author Chris Fehily immediately launches into the tasks that will get readers comfortable with SQL. In addition to covering all the SQL basics, this thoroughly updated reference contains a wealth of in-depth SQL knowledge and serves as an excellent reference for more experienced users.

Product Details

Peachpit Press
Publication date:
Visual QuickStart Guide Series
Edition description:
Third Edition
Sales rank:
Product dimensions:
6.94(w) x 8.92(h) x 1.01(d)

Table of Contents

Introduction     xi
About SQL     xii
About This Book     xvi
What You'll Need     xx
DBMS Specifics     1
Running SQL Programs     2
Microsoft Access     5
Microsoft SQL Server     10
Oracle     17
IBM DB2     20
MySQL     27
PostgreSQL     30
The Relational Model     33
Tables, Columns, and Rows     34
Primary Keys     38
Foreign Keys     40
Relationships     42
Normalization     45
The Sample Database     51
Creating the Sample Database     57
SQL Basics     61
SQL Syntax     62
SQL Standards and Conformance     65
Identifiers     66
Data Types     68
Character String Types     70
Binary Large Object Type     72
Exact Numeric Types     73
Approximate Numeric Types     75
Boolean Type     76
Datetime Types     77
Interval Types     80
Unique Identifiers     82
Other DataTypes     83
Nulls     84
Retrieving Data from a Table     87
Retrieving Columns with SELECT and FROM     88
Creating Column Aliases with AS     91
Eliminating Duplicate Rows with DISTINCT     93
Sorting Rows with ORDER BY     95
Filtering Rows with WHERE     101
Combining and Negating Conditions with AND, OR, and NOT     105
Matching Patterns with LIKE     114
Range Filtering with BETWEEN     118
List Filtering with IN     121
Testing for Nulls with IS NULL     124
Operators and Functions     127
Creating Derived Columns     128
Performing Arithmetic Operations     130
Determining the Order of Evaluation     133
Concatenating Strings with [double vertical line]     134
Extracting a Substring with SUBSTRING()     137
Changing String Case with UPPER() and LOWER()     140
Trimming Characters with TRIM()     142
Finding the Length of a String with CHARACTER_LENGTH()     147
Finding Substrings with POSITION()     149
Performing Datetime and Interval Arithmetic     152
Getting the Current Date and Time      154
Getting User Information     156
Converting Data Types with CAST()     157
Evaluating Conditional Values with CASE     161
Checking for Nulls with COALESCE()     165
Comparing Expressions with NULLIF()     166
Summarizing and Grouping Data     169
Using Aggregate Functions     170
Creating Aggregate Expressions     171
Finding a Minimum with MIN()     172
Finding a Maximum with MAX()     173
Calculating a Sum with SUM()     174
Calculating an Average with AVG()     175
Counting Rows with COUNT()     178
Aggregating Distinct Values with DISTINCT     179
Grouping Rows with GROUP BY     183
Filtering Groups with HAVING     190
Joins     193
Qualifying Column Names     194
Creating Table Aliases with AS     196
Using Joins     198
Creating Joins with Join or WHERE     200
Creating a Cross Join with CROSS JOIN     204
Creating a Natural Join with NATURAL JOIN     206
Creating an Inner Join with INNER JOIN     210
Creating Outer Joins with OUTER JOIN     235
Creating a Self-Join      247
Subqueries     253
Understanding Subqueries     254
Subquery Syntax     256
Subqueries vs. Joins     257
Simple and Correlated Subqueries     262
Qualifying Column Names in Subqueries     267
Nulls in Subqueries     268
Using Subqueries as Column Expressions     270
Comparing a Subquery Value by Using a Comparison Operator     275
Testing Set Membership with IN     281
Comparing All Subquery Values with ALL     288
Comparing Some Subquery Values with ANY     291
Testing Existence with EXISTS     294
Comparing Equivalent Queries     301
Set Operations     303
Combining Rows with UNION     304
Finding Common Rows with INTERSECT     310
Finding Different Rows with EXCEPT     312
Inserting, Updating, and Deleting Rows     315
Displaying Table Definitions     316
Inserting Rows with INSERT     319
Updating Rows with UPDATE     327
Deleting Rows with DELETE     333
Creating, Altering, and Dropping Tables     337
Creating Tables     338
Understanding Constraints     339
Creating a New Table with CREATE TABLE     341
Forbidding Nulls with NOT NULL     343
Specifying a Default Value with DEFAULT     346
Specifying a Primary Key with PRIMARY KEY     350
Specifying a Foreign Key with FOREIGN KEY     353
Forcing Unique Values with UNIQUE     359
Adding a Check Constraint with CHECK     363
Creating a Temporary Table with CREATE TEMPORARY TABLE     366
Creating a New Table from an Existing One with CREATE TABLE AS     369
Altering a Table with ALTER TABLE     373
Dropping a Table with DROP TABLE     376
Indexes     377
Creating an Index with CREATE INDEX     378
Dropping an Index with DROP INDEX     383
Views     385
Creating a View with CREATE VIEW     386
Retrieving Data Through a View     391
Updating Data Through a View     394
Dropping a View with DROP VIEW     398
Transactions     399
Executing a Transaction     400
SQL Tricks     405
Calculating Running Statistics     406
Generating Sequences     409
Finding Sequences, Runs, and Regions     415
Limiting the Number of Rows Returned      421
Assigning Ranks     430
Calculating a Trimmed Mean     432
Picking Random Rows     433
Handling Duplicates     435
Creating a Telephone List     438
Retrieving Metadata     439
Working with Dates     445
Calculating a Median     451
Finding Extreme Values     453
Changing Running Statistics Midstream     454
Pivoting Results     456
Working with Hierarchies     458
Index     465

Customer Reviews

Average Review:

Write a Review

and post it to your social network


Most Helpful Customer Reviews

See all customer reviews >

SQL, Third Edition (Visual QuickStart Guide Series) 5 out of 5 based on 0 ratings. 1 reviews.
CliffordTheConservative More than 1 year ago
Over the years I've used various books from the Visual QuickStart series, HTML, XML, JavaScript, VBScript, etc. to compliment training material provided by the various companies I've worked for over the years. Each book from the Visual QuickStart series is organized in a way as to build successively from basic to advanced concept, and within each chapter to build on a specific area drilling down through the topic providing an overview, a coding example and it's output, and usage tips. The end result is a great book for learning, and a great reference tool. The Visual QuickStart Guide for SQL is no exception to the this tried and true concept. During my "development days" in IT, I've spent a lot of time developing SQL for DB2 in COBOL programs, and later in the various iterations of MS Access, but as my career migrated away from development into more complex world of business analysis and project management those skills became rusty. Rather than acquire one of those 1,200-page "everything you ever wanted to know about SQL" texts or something from the "idiot's" or "dummies" series (which can be useful if you know nothing about the topic), I opted for a format that I was confortable with and trusted, and since my current assignment requires me to employ skills which were once common for me, I've returned to a format that has served me well in the past. SQL, third edition, not only stays true to the Visual QuickStart organization that I've found useful and productive during my career, but provides the quick and easy access to the topics I need to refresh my memory after a considerable absence from the development arts. While I've only had the book a couple of weeks, it has begun to deliver benefits in analyzing the data in several of the legacy DB2 tables with which I'm currently working. In closing, SQL, third edition, covers all of the major SQL proprietary variations, provides a good introduction, albeit brief, to relational database concepts, and proceeds to cover basic to advanced SQL coding and formatting specifics. I would recommend SQL, third edition, to both novice and experienced users as both a learning aid and a desk reference. And I would recommend the Visual QuickStart series as an excellent place to start when learning a new development skill; I've found this series quite useful over the course of my career, and have recommended the series to many of my colleagues.