Book description
As dynamic, database-driven Web sites become the standard, more
and more nonprogrammers just like yourself are being forced to work
with database information and create and edit database objects.
With SQL and this task-based guide to it, you can do it too--no
programming experience required!
After going over the relational database model and SQL syntax in
the first few chapters, veteran author Chris Fehily launches
into the tasks that will get you comfortable with SQL fast. In
addition to explaining SQL basics, this updated reference covers
the ANSI SQL:2003 standard and contains a wealth of brand-new
information, including a new chapter on set operations and common
tasks, well-placed optimization tips to make your queries run fast,
sidebars on advanced topics, and added IBM DB2 coverage.
Best of all, the book's examples were tested on the latest versions
of Microsoft Access, Microsoft SQL Server, Oracle, IBM DB2, MySQL,
and PostgreSQL. On the companion Web site, you can download the SQL
scripts and sample database for all these systems and put your
knowledge to work immediately on a real database..
Table of contents
- Copyright
- Introduction
- 1. DBMS Specifics
- 2. The Relational Model
- 3. SQL Basics
-
4. Retrieving Data From a Table
- Retrieving Columns with SELECT and FROM
- Creating Column Aliases with AS
- Eliminating Duplicate Rows with DISTINCT
- Sorting Rows with ORDER BY
- Filtering Rows with WHERE
- Combining and Negating Conditions with AND, OR, and NOT
- Matching Patterns with LIKE
- Range Filtering with BETWEEN
- List Filtering with IN
- Testing for Nulls with IS NULL
-
5. Operators and Functions
- Creating Derived Columns
- Performing Arithmetic Operations
- Determining the Order of Evaluation
- Concatenating Strings with ||
- To concatenate strings
- Extracting a Substring with SUBSTRING()
- Changing String Case with UPPER() and LOWER()
- Trimming Characters with TRIM()
- Finding the Length of a String with CHARACTER_LENGTH()
- Finding Substrings with POSITION()
- Performing Datetime and Interval Arithmetic
- Getting the Current Date and Time
- Getting User Information
- Converting Data Types with CAST()
- Evaluating Conditional Values with CASE
- Checking for Nulls with COALESCE()
- Comparing Expressions with NULLIF()
-
6. Summarizing and Grouping Data
- Using Aggregate Functions
- Creating Aggregate Expressions
- Finding a Minimum with MIN()
- Finding a Maximum with MAX()
- Calculating a Sum with SUM()
- Calculating an Average with AVG()
- Counting Rows with COUNT()
- Aggregating Distinct Values with DISTINCT
- Grouping Rows with GROUP BY
- Filtering Groups with HAVING
- 7. Joins
-
8. Subqueries
- Understanding Subqueries
- Subquery Syntax
- Subqueries vs. Joins
- Simple and Correlated Subqueries
- Qualifying Column Names in Subqueries
- Nulls in Subqueries
- Using Subqueries as Column Expressions
- Comparing a Subquery Value by Using a Comparison Operator
- Testing Set Membership with IN
- Comparing All Subquery Values with ALL
- Comparing Some Subquery Values with ANY
- Testing Existence with EXISTS
- Comparing Equivalent Queries
-
9. Set Operations
- Combining Rows with UNION
- Finding Common Rows with INTERSECT
- Finding Different Rows with EXCEPT
- Calculating Running Statistics
- Generating Sequences
- Finding Sequences, Runs, and Regions
- Limiting the Number of Rows Returned
- Assigning Ranks
- Calculating a Trimmed Mean
- Picking Random Rows
- Handling Duplicates
- 10. Inserting, Updating, and Deleting Rows
-
11. Creating, Altering, and Dropping Tables
- Creating Tables
- Understanding Constraints
- Creating a New Table with CREATE TABLE
- Forbidding Nulls with NOT NULL
- Specifying a Default Value with DEFAULT
- Specifying a Primary Key with PRIMARY KEY
- Specifying a Foreign Key with FOREIGN KEY
- Forcing Unique Values with UNIQUE
- Adding a Check Constraint with CHECK
- Creating a Temporary Table with CREATE TEMPORARY TABLE
- Creating a New Table from an Existing One with CREATE TABLE AS
- Altering a Table with ALTER TABLE
- Dropping a Table with DROP TABLE
- 12. Indexes
- 13. Views
- 14. Transactions
- A. Creating the Sample Database
- B. SQL Keywords
Product information
- Title: SQL: Visual Quickstart Guide, Second Edition
- Author(s):
- Release date: May 2005
- Publisher(s): Peachpit Press
- ISBN: 9780321334176
You might also like
book
SQL: Visual QuickStart Guide, Third Edition
SQL is a standard interactive and programming language for querying and modifying data and managing databases. …
book
SQL: Visual QuickStart Guide
Database management. It may sound daunting, but it doesn't have to be, even if you've never …
book
SQL: A Beginner's Guide, Third Edition, 3rd Edition
Essential Skills--Made Easy! Written to the SQL:2006 ANSI/ISO standard, this easy-to-follow guide will get you started …
book
SQL: A Beginner's Guide, Fourth Edition, 4th Edition
This fully revised, self-paced learning tool lays out all the necessary steps to quickly and easily …