SQL

Book description

SQL is a solid guide and reference to the key elements of SQL and how to use it effectively. Developed by authors who needed a good resource for students in their database class, this is an ideal supplement for database courses — no matter what main text you use or what flavor of SQL is required.

It features a short and inexpensive introduction to SQL for students who have some programming experience and need to learn the main features of SQL; and suggested shortcuts for learning and practice, depending on the experience of the user.

This book is recommended for novice developers, programmers, and database administrators as well as students in database courses, business courses, and IT-related courses.

  • Provides tutorial-based instruction for the main features of SQL for programmers and other technical professionals in need of a brief but really good introduction to SQL.
  • The approach is vendor-neutral—so very adaptable and flexible
  • The focus is on teaching concepts by walking through concrete examples and explanations, and self-review exercises are included at the end of each chapter.
  • Coverage is on the key features of the language that are required to understand SQL and begin using it effectively.
  • SQL 2003-compliant.

Table of contents

  1. Cover
  2. SQL: Practical Guide for Developers
  3. Copyright
  4. Table of Contents (1/2)
  5. Table of Contents (2/2)
  6. Preface
  7. Chapter 1. Databasics
    1. 1.1 Tables
    2. 1.2 Data Types
    3. 1.3 NULL
    4. 1.4 Primary Key
    5. 1.5 Table Relationships
    6. 1.6 Restaurant Database (1/2)
    7. 1.6 Restaurant Database (2/2)
    8. 1.7 Wrap Up (1/2)
    9. 1.7 Wrap Up (2/2)
  8. Chapter 2. Retrieval: Basic SELECTion
    1. 2.1 Simple SELECT
    2. 2.2 Selecting Rows
    3. 2.3 Standard Comparison Operators
    4. 2.4 String Comparisons
    5. 2.5 Matching String Patterns with LIKE
    6. 2.6 Getting What We Haven't Got with NOT
    7. 2.7 Combining Conditions with AND and OR
    8. 2.8 Selecting a Range of Values with BETWEEN
    9. 2.9 Selecting a Set of Values Using IN
    10. 2.10 IS NULL: Exploring the Unknown
    11. 2.11 ANDs, ORs, NOTs with NULLs: Three-Valued Logic
    12. 2.12 Three-Valued Logic and the IN Operator
    13. 2.13 How WHERE Determines What's In and Out
    14. 2.14 Wrap Up
  9. Chapter 3. Reshaping Results
    1. 3.1 AS: Naming Result Table Columns
    2. 3.2 DISTINCT and ALL: Dealing with Duplicates
    3. 3.3 Derived Attributes (1/2)
    4. 3.3 Derived Attributes (2/2)
    5. 3.4 Computation in the WHERE Clause
    6. 3.5 ORDER BY: Ordering Result Table Traversal
    7. 3.6 CAST: Data Type Conversion
    8. 3.7 CASE, COALESCE, and NULLIF: Conditional Expressions
    9. 3.8 Wrap Up
  10. Chapter 4. Aggregating Results
    1. 4.1 Aggregation Functions
    2. 4.2 Removing Rows before Aggregation with WHERE
    3. 4.3 Removing Repeating Data with DISTINCT before Aggregation
    4. 4.4 Mixing Attributes, Aggregates, and Literals
    5. 4.5 Group Aggregation Using GROUP BY
    6. 4.6 Removing Rows before Grouping with WHERE
    7. 4.7 Sorting Groups with ORDER BY
    8. 4.8 Removing Groups with HAVING
    9. 4.9 Aggregates over Expressions
    10. 4.10 Wrap Up
  11. Chapter 5. Joins
    1. 5.1 Two Table Joins with WHERE
    2. 5.2 Table Aliases
    3. 5.3 Joins Needing More Than Two Tables
    4. 5.4 Self-Join: Joining a Table with Itself
    5. 5.5 Example Joins
    6. 5.6 How Does a Join Really Work?
    7. 5.7 Theta Joins: Generalizing Join Predicates
    8. 5.8 JOIN Operator (1/2)
    9. 5.8 JOIN Operator (2/2)
    10. 5.9 Join Strategies
    11. 5.10 Wrap Up
  12. Chapter 6. Set Queries: UNION, INTERSECT, and EXCEPT
    1. 6.1 UNION
    2. 6.2 INTERSECT
    3. 6.3 EXCEPT
    4. 6.4 Wrap Up
  13. Chapter 7. Subqueries
    1. 7.1 What Are Subqueries?
    2. 7.2 Multilevel Subquery Nesting
    3. 7.3 Subqueries Using NOT IN
    4. 7.4 Subqueries with Empty Results
    5. 7.5 Combining JOIN and Subqueries
    6. 7.6 Standard Comparison Operators with Lists Using ANY, SOME, or ALL (1/2)
    7. 7.6 Standard Comparison Operators with Lists Using ANY, SOME, or ALL (2/2)
    8. 7.7 Correlated Subqueries
    9. 7.8 EXISTS
    10. 7.9 Derived Relations„Subqueries in the FROM Clause
    11. 7.10 Subqueries in the HAVING Clause
    12. 7.11 Subset Queries (1/2)
    13. 7.11 Subset Queries (2/2)
    14. 7.12 Subqueries in the SELECT Clause
    15. 7.13 Wrap Up (1/2)
    16. 7.13 Wrap Up (2/2)
  14. Chapter 8. Modifying Data
    1. 8.1 INSERT: Adding New Rows
    2. 8.2 DELETE: Removing Rows
    3. 8.3 UPDATE: Changing Row Values
    4. 8.4 Testing Your DELETE and UPDATE WHERE Conditions
    5. 8.5 Living within Constraints
    6. 8.6 Wrap Up
  15. Chapter 9. Creating, Deleting, and Altering Tables
    1. 9.1 Creating Simple Tables
    2. 9.2 DEFAULT Values
    3. 9.3 Constraints (1/2)
    4. 9.3 Constraints (2/2)
    5. 9.4 Creating a Table from Tables
    6. 9.5 CREATE DOMAIN
    7. 9.6 Referential Actions: The Autopilot of Foreign Key Maintenance
    8. 9.7 Indexes
    9. 9.8 DROP TABLE
    10. 9.9 ALTER TABLE
    11. 9.10 Generated Values
    12. 9.11 Sequences
    13. 9.12 Global and Local Temporary Tables
    14. 9.13 Creating a Database
    15. 9.14 Wrap Up (1/2)
    16. 9.14 Wrap Up (2/2)
  16. Chapter 10. Views
    1. 10.1 Why Views?
    2. 10.2 Querying Views
    3. 10.3 Updating Views
    4. 10.4 DROP VIEW
    5. 10.5 Wrap Up
  17. Chapter 11. Transactions
    1. 11.1 Ending a Transaction„COMMIT and ROLLBACK
    2. 11.2 Starting a Transaction„START TRANSACTION
    3. 11.3 Auto-Commit
    4. 11.4 SAVEPOINTs
    5. 11.5 Immediate or Deferred Constraints
    6. 11.6 Testing Changes with Transactions
    7. 11.7 Transaction Characteristics
    8. 11.8 Locking Issues
    9. 11.9 Wrap Up
  18. Chapter 12. Database Privileges
    1. 12.1 GRANT
    2. 12.2 REVOKE
    3. 12.3 PUBLIC
    4. 12.4 Creating a Set of Privileges Using ROLEs
    5. 12.5 Using Privileges and Views
    6. 12.6 Wrap Up
  19. Chapter 13. Introduction to Cursors, Embedded SQL, Stored Procedures, and Triggers
    1. 13.1 CURSORs
    2. 13.2 Programming with SQL
    3. 13.3 Triggers
    4. 13.4 Wrap Up
  20. Index (1/2)
  21. Index (2/2)

Product information

  • Title: SQL
  • Author(s): Michael J. Donahoo, Gregory D. Speegle
  • Release date: July 2010
  • Publisher(s): Morgan Kaufmann
  • ISBN: 9780080489742