SQL For Dummies®, 7th Edition

Book description

Learn SQL the fun and easy way – no programming experience needed!

SQL For Dummies, 7th Edition, shows programmers and web developers how to use SQL to build relational databases and get valuable information from them. This book covers the core features of the SQL language. Topics covered include how to use SQL to structure a DBMS and implement a database design; secure a database; and retrieve information from a database. This edition will be revised to reflect the new enhancements of SQL/XML:2008.

The latest update of the perennial bestselling SQL For Dummies, which has sold more than 210,000 units in six editions.

SQL is the most popular database language in the world

Covers creating, accessing, manipulating, maintaining, and storing information in relational database management systems (DBMS) such as Access, Oracle, SQL Server, and MySQL.

Includes new content on using SQL with XML to power data-driven web sites and using SQL with Access 2010

Whether you're daunted by database development or a system admin star, SQL For Dummies, 7th Dummies will have you working your web site in no time at all.

Table of contents

  1. Copyright
  2. About The Author
  3. Author's Acknowledgments
  4. Publisher's Acknowledgments
  5. Introduction
    1. About This Book
    2. Who Should Read This Book?
    3. How This Book Is Organized
      1. Part I: Basic Concepts
      2. Part II: Using SQL to Build Databases
      3. Part III: Storing and Retrieving Data
      4. Part IV: Controlling Operations
      5. Part V: Taking SQL to the Real World
      6. Part VI: Advanced Topics
      7. Part VII: The Part of Tens
      8. Appendix and glossary
    4. Icons Used in This Book
    5. Getting Started
  6. I. Basic Concepts
    1. 1. Relational Database Fundamentals
      1. 1.1. Keeping Track of Things
      2. 1.2. What Is a Database?
      3. 1.3. Database Size and Complexity
      4. 1.4. What Is a Database Management System?
      5. 1.5. Flat Files
      6. 1.6. Database Models
        1. 1.6.1. Relational model
        2. 1.6.2. Why relational is better
        3. 1.6.3. Components of a relational database
        4. 1.6.4. Dealing with your relations
        5. 1.6.5. Enjoy the view
        6. 1.6.6. Schemas, domains, and constraints
          1. 1.6.6.1. Schemas
          2. 1.6.6.2. Domains
          3. 1.6.6.3. Constraints
        7. 1.6.7. The object model challenges the relational model
        8. 1.6.8. The object-relational model
      7. 1.7. Database Design Considerations
    2. 2. SQL Fundamentals
      1. 2.1. What SQL Is and Isn't
      2. 2.2. A (Very) Little History
      3. 2.3. SQL Statements
      4. 2.4. Reserved Words
      5. 2.5. Data Types
        1. 2.5.1. Exact numerics
          1. 2.5.1.1. INTEGER data type
          2. 2.5.1.2. SMALLINT data type
          3. 2.5.1.3. BIGINT data type
          4. 2.5.1.4. NUMERIC data type
          5. 2.5.1.5. DECIMAL data type
        2. 2.5.2. Approximate numerics
          1. 2.5.2.1. REAL data type
          2. 2.5.2.2. DOUBLE PRECISION data type
          3. 2.5.2.3. FLOAT data type
        3. 2.5.3. Character strings
          1. 2.5.3.1. CHARACTER data type
          2. 2.5.3.2. CHARACTER VARYING data type
          3. 2.5.3.3. CHARACTER LARGE OBJECT data type
          4. 2.5.3.4. NATIONAL CHARACTER, NATIONAL CHARACTER VARYING, and NATIONAL CHARACTER LARGE OBJECT data types
        4. 2.5.4. Binary strings
          1. 2.5.4.1. BINARY data type
          2. 2.5.4.2. BINARY VARYING data type
          3. 2.5.4.3. BINARY LARGE OBJECT data type
        5. 2.5.5. Booleans
        6. 2.5.6. Datetimes
          1. 2.5.6.1. DATE data type
          2. 2.5.6.2. TIME WITHOUT TIME ZONE data type
          3. 2.5.6.3. TIMESTAMP WITHOUT TIME ZONE data type
          4. 2.5.6.4. TIME WITH TIME ZONE data type
          5. 2.5.6.5. TIMESTAMP WITH TIME ZONE data type
        7. 2.5.7. Intervals
        8. 2.5.8. XML type
        9. 2.5.9. ROW types
        10. 2.5.10. Collection types
          1. 2.5.10.1. ARRAY type
          2. 2.5.10.2. MULTISET type
        11. 2.5.11. REF types
        12. 2.5.12. User-defined types
          1. 2.5.12.1. Distinct types
          2. 2.5.12.2. Structured types
            1. 2.5.12.2.1. Constructors
            2. 2.5.12.2.2. Mutators and observers
            3. 2.5.12.2.3. Subtypes and supertypes
            4. 2.5.12.2.4. Example of a structured type
        13. 2.5.13. Data type summary
      6. 2.6. Null Values
      7. 2.7. Constraints
      8. 2.8. Using SQL in a Client/Server System
        1. 2.8.1. The server
          1. 2.8.1.1. What the server is
          2. 2.8.1.2. What the server does
        2. 2.8.2. The client
          1. 2.8.2.1. What the client is
          2. 2.8.2.2. What the client does
      9. 2.9. Using SQL on the Internet or an Intranet
    3. 3. The Components of SQL
      1. 3.1. Data Definition Language
        1. 3.1.1. When "Just do it!" is not good advice
        2. 3.1.2. Creating tables
        3. 3.1.3. A room with a view
          1. 3.1.3.1. Single-table view
          2. 3.1.3.2. Creating a multitable view
        4. 3.1.4. Collecting tables into schemas
        5. 3.1.5. Ordering by catalog
        6. 3.1.6. Getting familiar with DDL statements
          1. 3.1.6.1. CREATE
          2. 3.1.6.2. ALTER
          3. 3.1.6.3. DROP
      2. 3.2. Data Manipulation Language
        1. 3.2.1. Value expressions
          1. 3.2.1.1. Numeric value expressions
          2. 3.2.1.2. String value expressions
          3. 3.2.1.3. Datetime and interval value expressions
          4. 3.2.1.4. Boolean value expressions
          5. 3.2.1.5. User-defined type value expressions
          6. 3.2.1.6. Row value expressions
          7. 3.2.1.7. Collection value expressions
          8. 3.2.1.8. Reference value expressions
        2. 3.2.2. Predicates
        3. 3.2.3. Logical connectives
        4. 3.2.4. Set functions
          1. 3.2.4.1. COUNT
          2. 3.2.4.2. MAX
          3. 3.2.4.3. MIN
          4. 3.2.4.4. SUM
          5. 3.2.4.5. AVG
        5. 3.2.5. Subqueries
      3. 3.3. Data Control Language
        1. 3.3.1. Transactions
        2. 3.3.2. Users and privileges
        3. 3.3.3. Referential integrity constraints can jeopardize your data
        4. 3.3.4. Delegating responsibility for security
  7. II. Using SQL to Build Databases
    1. 4. Building and Maintaining a Simple Database Structure
      1. 4.1. Using a RAD Tool to Build a Simple Database
        1. 4.1.1. Deciding what to track
        2. 4.1.2. Creating a database table
          1. 4.1.2.1. Building a database table in Datasheet view
          2. 4.1.2.2. Building a database table in Design view
        3. 4.1.3. Altering the table structure
        4. 4.1.4. Creating an index
        5. 4.1.5. Deleting a table
      2. 4.2. Building POWER with SQL's DDL
        1. 4.2.1. Using SQL with Microsoft Access
        2. 4.2.2. Creating a table
        3. 4.2.3. Creating an index
        4. 4.2.4. Altering the table structure
        5. 4.2.5. Deleting a table
        6. 4.2.6. Deleting an index
      3. 4.3. Portability Considerations
    2. 5. Building a Multitable Relational Database
      1. 5.1. Designing a Database
        1. 5.1.1. Step 1: Defining objects
        2. 5.1.2. Step 2: Identifying tables and columns
        3. 5.1.3. Step 3: Defining tables
        4. 5.1.4. Domains, character sets, collations, and translations
        5. 5.1.5. Getting into your database fast with keys
          1. 5.1.5.1. Primary keys
          2. 5.1.5.2. Foreign keys
      2. 5.2. Working with Indexes
        1. 5.2.1. What's an index, anyway?
        2. 5.2.2. Why you should want an index
        3. 5.2.3. Maintaining an index
      3. 5.3. Maintaining Data Integrity
        1. 5.3.1. Entity integrity
        2. 5.3.2. Domain integrity
        3. 5.3.3. Referential integrity
          1. 5.3.3.1. Trouble between parent and child tables
          2. 5.3.3.2. Cascading deletions — use with care
          3. 5.3.3.3. Alternative ways to control update anomalies
        4. 5.3.4. Just when you thought it was safe . . .
          1. 5.3.4.1. Adding a column to an existing table
          2. 5.3.4.2. Deleting a column from an existing table
        5. 5.3.5. Potential problem areas
          1. 5.3.5.1. Bad input data
          2. 5.3.5.2. Operator error
          3. 5.3.5.3. Mechanical failure
          4. 5.3.5.4. Malice
          5. 5.3.5.5. Data redundancy
          6. 5.3.5.6. Exceeding the capacity of your DBMS
        6. 5.3.6. Constraints
          1. 5.3.6.1. Column constraints
          2. 5.3.6.2. Table constraints
          3. 5.3.6.3. Assertions
      4. 5.4. Normalizing the Database
        1. 5.4.1. Modification anomalies and normal forms
        2. 5.4.2. First normal form
        3. 5.4.3. Second normal form
        4. 5.4.4. Third normal form
        5. 5.4.5. Domain-key normal form (DK/NF)
        6. 5.4.6. Abnormal form
  8. III. Storing and Retrieving Data
    1. 6. Manipulating Database Data
      1. 6.1. Retrieving Data
      2. 6.2. Creating Views
        1. 6.2.1. From tables
        2. 6.2.2. With a selection condition
        3. 6.2.3. With a modified attribute
      3. 6.3. Updating Views
      4. 6.4. Adding New Data
        1. 6.4.1. Adding data one row at a time
        2. 6.4.2. Adding data only to selected columns
        3. 6.4.3. Adding a block of rows to a table
          1. 6.4.3.1. Copying from a foreign data file
          2. 6.4.3.2. Transferring all rows between tables
          3. 6.4.3.3. Transferring selected columns and rows between tables
      5. 6.5. Updating Existing Data
      6. 6.6. Transferring Data
      7. 6.7. Deleting Obsolete Data
    2. 7. Specifying Values
      1. 7.1. Values
        1. 7.1.1. Row values
        2. 7.1.2. Literal values
        3. 7.1.3. Variables
        4. 7.1.4. Special variables
        5. 7.1.5. Column references
      2. 7.2. Value Expressions
        1. 7.2.1. String value expressions
        2. 7.2.2. Numeric value expressions
        3. 7.2.3. Datetime value expressions
        4. 7.2.4. Interval value expressions
        5. 7.2.5. Conditional value expressions
      3. 7.3. Functions
        1. 7.3.1. Summarizing by using set functions
          1. 7.3.1.1. COUNT
          2. 7.3.1.2. AVG
          3. 7.3.1.3. MAX
          4. 7.3.1.4. MIN
          5. 7.3.1.5. SUM
        2. 7.3.2. Value functions
          1. 7.3.2.1. String value functions
            1. 7.3.2.1.1. SUBSTRING
            2. 7.3.2.1.2. SUBSTRING SIMILAR
            3. 7.3.2.1.3. SUBSTRING_REGEX
            4. 7.3.2.1.4. TRANSLATE_REGEX
            5. 7.3.2.1.5. OVERLAY
            6. 7.3.2.1.6. UPPER
            7. 7.3.2.1.7. LOWER
            8. 7.3.2.1.8. TRIM
            9. 7.3.2.1.9. TRANSLATE and CONVERT
          2. 7.3.2.2. Numeric value functions
            1. 7.3.2.2.1. POSITION
            2. 7.3.2.2.2. OCCURRENCES_REGEX
            3. 7.3.2.2.3. POSITION_REGEX
            4. 7.3.2.2.4. EXTRACT
            5. 7.3.2.2.5. CHARACTER_LENGTH
            6. 7.3.2.2.6. OCTET_LENGTH
            7. 7.3.2.2.7. CARDINALITY
            8. 7.3.2.2.8. ABS
            9. 7.3.2.2.9. MOD
            10. 7.3.2.2.10. LN
            11. 7.3.2.2.11. EXP
            12. 7.3.2.2.12. POWER
            13. 7.3.2.2.13. SQRT
            14. 7.3.2.2.14. FLOOR
            15. 7.3.2.2.15. CEIL or CEILING
            16. 7.3.2.2.16. WIDTH_BUCKET
          3. 7.3.2.3. Datetime value functions
          4. 7.3.2.4. Interval value functions
    3. 8. Using Advanced SQL Value Expressions
      1. 8.1. CASE Conditional Expressions
        1. 8.1.1. Using CASE with search conditions
          1. 8.1.1.1. Updating values based on a condition
          2. 8.1.1.2. Avoiding conditions that cause errors
        2. 8.1.2. Using CASE with values
        3. 8.1.3. A special CASE — NULLIF
        4. 8.1.4. Another special CASE — COALESCE
      2. 8.2. CAST Data-Type Conversions
        1. 8.2.1. Using CAST within SQL
        2. 8.2.2. Using CAST between SQL and the host language
      3. 8.3. Row Value Expressions
    4. 9. Zeroing In on the Data You Want
      1. 9.1. Modifying Clauses
      2. 9.2. FROM Clauses
      3. 9.3. WHERE Clauses
        1. 9.3.1. Comparison predicates
        2. 9.3.2. BETWEEN
        3. 9.3.3. IN and NOT IN
        4. 9.3.4. LIKE and NOT LIKE
        5. 9.3.5. SIMILAR
        6. 9.3.6. NULL
        7. 9.3.7. ALL, SOME, ANY
        8. 9.3.8. EXISTS
        9. 9.3.9. UNIQUE
        10. 9.3.10. DISTINCT
        11. 9.3.11. OVERLAPS
        12. 9.3.12. MATCH
        13. 9.3.13. Referential integrity rules and the MATCH predicate
      4. 9.4. Logical Connectives
        1. 9.4.1. AND
        2. 9.4.2. OR
        3. 9.4.3. NOT
      5. 9.5. GROUP BY Clauses
      6. 9.6. HAVING Clauses
      7. 9.7. ORDER BY Clauses
    5. 10. Using Relational Operators
      1. 10.1. UNION
        1. 10.1.1. The UNION ALL operation
        2. 10.1.2. The CORRESPONDING operation
      2. 10.2. INTERSECT
      3. 10.3. EXCEPT
      4. 10.4. Various Joins
        1. 10.4.1. Basic join
        2. 10.4.2. Equi-join
        3. 10.4.3. Cross join
        4. 10.4.4. Natural join
        5. 10.4.5. Condition join
        6. 10.4.6. Column-name join
        7. 10.4.7. Inner join
        8. 10.4.8. Outer join
          1. 10.4.8.1. Left outer join
          2. 10.4.8.2. Right outer join
          3. 10.4.8.3. Full outer join
        9. 10.4.9. Union join
      5. 10.5. ON versus WHERE
    6. 11. Delving Deep with Nested Queries
      1. 11.1. What Subqueries Do
        1. 11.1.1. Nested queries that return sets of rows
          1. 11.1.1.1. Subqueries introduced by the keyword IN
          2. 11.1.1.2. Subqueries introduced by the keyword NOT IN
        2. 11.1.2. Nested queries that return a single value
        3. 11.1.3. The ALL, SOME, and ANY quantifiers
        4. 11.1.4. Nested queries that are an existence test
          1. 11.1.4.1. EXISTS
          2. 11.1.4.2. NOT EXISTS
        5. 11.1.5. Other correlated subqueries
          1. 11.1.5.1. Correlated subqueries introduced with IN
          2. 11.1.5.2. Subqueries introduced with comparison operators
          3. 11.1.5.3. Subqueries in a HAVING clause
        6. 11.1.6. UPDATE, DELETE, and INSERT
    7. 12. Recursive Queries
      1. 12.1. What Is Recursion?
        1. 12.1.1. Houston, we have a problem
        2. 12.1.2. Failure is not an option
      2. 12.2. What Is a Recursive Query?
      3. 12.3. Where Might You Use a Recursive Query?
        1. 12.3.1. Querying the hard way
        2. 12.3.2. Saving time with a recursive query
      4. 12.4. Where Else Might You Use a Recursive Query?
  9. IV. Controlling Operations
    1. 13. Providing Database Security
      1. 13.1. The SQL Data Control Language
      2. 13.2. User Access Levels
        1. 13.2.1. The database administrator
        2. 13.2.2. Database object owners
        3. 13.2.3. The public
      3. 13.3. Granting Privileges to Users
        1. 13.3.1. Roles
        2. 13.3.2. Inserting data
        3. 13.3.3. Looking at data
        4. 13.3.4. Modifying table data
        5. 13.3.5. Deleting obsolete rows from a table
        6. 13.3.6. Referencing related tables
        7. 13.3.7. Using domains, character sets, collations, and translations
        8. 13.3.8. Causing SQL statements to be executed
      4. 13.4. Granting Privileges across Levels
      5. 13.5. Granting the Power to Grant Privileges
      6. 13.6. Taking Privileges Away
      7. 13.7. Using GRANT and REVOKE Together to Save Time and Effort
    2. 14. Protecting Data
      1. 14.1. Threats to Data Integrity
        1. 14.1.1. Platform instability
        2. 14.1.2. Equipment failure
        3. 14.1.3. Concurrent access
          1. 14.1.3.1. Transaction interaction trouble
          2. 14.1.3.2. Serialization eliminates harmful interactions
      2. 14.2. Reducing Vulnerability to Data Corruption
        1. 14.2.1. Using SQL transactions
        2. 14.2.2. The default transaction
        3. 14.2.3. Isolation levels
          1. 14.2.3.1. Getting mucked up by a dirty read
          2. 14.2.3.2. Getting bamboozled by a nonrepeatable read
          3. 14.2.3.3. Risking the phantom read
          4. 14.2.3.4. Getting a reliable (if slower) read
        4. 14.2.4. The implicit transaction-starting statement
        5. 14.2.5. SET TRANSACTION
        6. 14.2.6. COMMIT
        7. 14.2.7. ROLLBACK
        8. 14.2.8. Locking database objects
        9. 14.2.9. Backing up your data
        10. 14.2.10. Savepoints and subtransactions
      3. 14.3. Constraints Within Transactions
    3. 15. Using SQL within Applications
      1. 15.1. SQL in an Application
        1. 15.1.1. Keeping an eye out for the asterisk
        2. 15.1.2. SQL strengths and weaknesses
        3. 15.1.3. Procedural languages' strengths and weaknesses
        4. 15.1.4. Problems in combining SQL with a procedural language
          1. 15.1.4.1. Contrasting operating modes
          2. 15.1.4.2. Data type incompatibilities
      2. 15.2. Hooking SQL into Procedural Languages
        1. 15.2.1. Embedded SQL
          1. 15.2.1.1. Declaring host variables
          2. 15.2.1.2. Converting data types
        2. 15.2.2. Module language
          1. 15.2.2.1. Module declarations
          2. 15.2.2.2. Module procedures
        3. 15.2.3. Object-oriented RAD tools
        4. 15.2.4. Using SQL with Microsoft Access
  10. V. Taking SQL to the Real World
    1. 16. Accessing Data with ODBC and JDBC
      1. 16.1. ODBC
        1. 16.1.1. The ODBC interface
        2. 16.1.2. Components of ODBC
      2. 16.2. ODBC in a Client/Server Environment
      3. 16.3. ODBC and the Internet
        1. 16.3.1. Server extensions
        2. 16.3.2. Client extensions
          1. 16.3.2.1. Helper applications
          2. 16.3.2.2. ActiveX controls
          3. 16.3.2.3. Scripts
      4. 16.4. ODBC and an Intranet
      5. 16.5. JDBC
    2. 17. Operating on XML Data with SQL
      1. 17.1. How XML Relates to SQL
      2. 17.2. The XML Data Type
        1. 17.2.1. When to use the XML type
        2. 17.2.2. When not to use the XML type
      3. 17.3. Mapping SQL to XML and XML to SQL
        1. 17.3.1. Mapping character sets
        2. 17.3.2. Mapping identifiers
        3. 17.3.3. Mapping data types
        4. 17.3.4. Mapping tables
        5. 17.3.5. Handling null values
        6. 17.3.6. Generating the XML Schema
      4. 17.4. SQL Functions That Operate on XML Data
        1. 17.4.1. XMLDOCUMENT
        2. 17.4.2. XMLELEMENT
        3. 17.4.3. XMLFOREST
        4. 17.4.4. XMLCONCAT
        5. 17.4.5. XMLAGG
        6. 17.4.6. XMLCOMMENT
        7. 17.4.7. XMLPARSE
        8. 17.4.8. XMLPI
        9. 17.4.9. XMLQUERY
        10. 17.4.10. XMLCAST
      5. 17.5. Predicates
        1. 17.5.1. DOCUMENT
        2. 17.5.2. CONTENT
        3. 17.5.3. XMLEXISTS
        4. 17.5.4. VALID
      6. 17.6. Transforming XML Data into SQL Tables
      7. 17.7. Mapping Non-Predefined Data Types to XML
        1. 17.7.1. Domain
        2. 17.7.2. Distinct UDT
        3. 17.7.3. Row
        4. 17.7.4. Array
        5. 17.7.5. Multiset
      8. 17.8. The Marriage of SQL and XML
  11. VI. Advanced Topics
    1. 18. Stepping through a Dataset with Cursors
      1. 18.1. Declaring a Cursor
        1. 18.1.1. Query expression
        2. 18.1.2. ORDER BY clause
        3. 18.1.3. Updatability clause
        4. 18.1.4. Sensitivity
        5. 18.1.5. Scrollability
      2. 18.2. Opening a Cursor
      3. 18.3. Fetching Data from a Single Row
        1. 18.3.1. Syntax
        2. 18.3.2. Orientation of a scrollable cursor
        3. 18.3.3. Positioned DELETE and UPDATE statements
      4. 18.4. Closing a Cursor
    2. 19. Adding Procedural Capabilities with Persistent Stored Modules
      1. 19.1. Compound Statements
        1. 19.1.1. Atomicity
        2. 19.1.2. Variables
        3. 19.1.3. Cursors
        4. 19.1.4. Conditions
        5. 19.1.5. Handling conditions
          1. 19.1.5.1. Handler declarations
          2. 19.1.5.2. Handler actions and handler effects
        6. 19.1.6. Conditions that aren't handled
        7. 19.1.7. Assignment
      2. 19.2. Flow of Control Statements
        1. 19.2.1. IF...THEN...ELSE...END IF
        2. 19.2.2. CASE...END CASE
          1. 19.2.2.1. Simple CASE statement
          2. 19.2.2.2. Searched CASE statement
        3. 19.2.3. LOOP...ENDLOOP
        4. 19.2.4. LEAVE
        5. 19.2.5. WHILE...DO...END WHILE
        6. 19.2.6. REPEAT...UNTIL...END REPEAT
        7. 19.2.7. FOR...DO...END FOR
        8. 19.2.8. ITERATE
      3. 19.3. Stored Procedures
      4. 19.4. Stored Functions
      5. 19.5. Privileges
      6. 19.6. Stored Modules
    3. 20. Handling Errors
      1. 20.1. SQLSTATE
      2. 20.2. WHENEVER Clause
      3. 20.3. Diagnostics Areas
        1. 20.3.1. Diagnostics header area
        2. 20.3.2. Diagnostics detail area
        3. 20.3.3. Constraint violation example
        4. 20.3.4. Adding constraints to an existing table
        5. 20.3.5. Interpreting the information returned by SQLSTATE
      4. 20.4. Handling Exceptions
    4. 21. Triggers
      1. 21.1. Examining Some Applications of Triggers
      2. 21.2. Creating a Trigger
        1. 21.2.1. Statement and row triggers
        2. 21.2.2. When a trigger fires
        3. 21.2.3. The triggered SQL statement
        4. 21.2.4. An example trigger definition
      3. 21.3. Firing a Succession of Triggers
      4. 21.4. Referencing Old Values and New Values
      5. 21.5. Firing Multiple Triggers on a Single Table
  12. VII. The Part of Tens
    1. 22. Ten Common Mistakes
      1. 22.1. Assuming That Your Clients Know What They Need
      2. 22.2. Ignoring Project Scope
      3. 22.3. Considering Only Technical Factors
      4. 22.4. Not Asking for Client Feedback
      5. 22.5. Always Using Your Favorite Development Environment
      6. 22.6. Using Your Favorite System Architecture Exclusively
      7. 22.7. Designing Database Tables in Isolation
      8. 22.8. Neglecting Design Reviews
      9. 22.9. Skipping Beta Testing
      10. 22.10. Not Documenting Your Process
    2. 23. Ten Retrieval Tips
      1. 23.1. Verify the Database Structure
      2. 23.2. Try Queries on a Test Database
      3. 23.3. Double-Check Queries That Include Joins
      4. 23.4. Triple-Check Queries with Subselects
      5. 23.5. Summarize Data with GROUP BY
      6. 23.6. Watch GROUP BY Clause Restrictions
      7. 23.7. Use Parentheses with AND, OR, and NOT
      8. 23.8. Control Retrieval Privileges
      9. 23.9. Back Up Your Databases Regularly
      10. 23.10. Handle Error Conditions Gracefully
  13. A. SQL:2008 Reserved Words
  14. Bonus Content: Glossary

Product information

  • Title: SQL For Dummies®, 7th Edition
  • Author(s): Allen G. Taylor
  • Release date: February 2010
  • Publisher(s): For Dummies
  • ISBN: 9780470557419