| Databasics | p. 1 |
| Tables | p. 3 |
| Data Types | p. 4 |
| Character String | p. 4 |
| Numeric | p. 5 |
| Temporal | p. 6 |
| Binary | p. 7 |
| Boolean | p. 8 |
| Other Data Types | p. 8 |
| NULL | p. 8 |
| Primary Key | p. 9 |
| Table Relationships | p. 9 |
| Foreign Key | p. 10 |
| Relationship Types | p. 11 |
| Schemas | p. 14 |
| Restaurant Database | p. 15 |
| Wrap Up | p. 21 |
| Retrieval: Basic SELECTion | p. 27 |
| Simple SELECT | p. 27 |
| Selecting Rows | p. 30 |
| Standard Comparison Operators | p. 30 |
| String Comparisons | p. 31 |
| Matching String Patterns with LIKE | p. 33 |
| Getting What We Haven't Got with NOT | p. 34 |
| Combining Conditions with AND and OR | p. 35 |
| Selecting a Range of Values with BETWEEN | p. 37 |
| Selecting a Set of Values Using IN | p. 38 |
| IS NULL: Exploring the Unknown | p. 38 |
| ANDs, ORs, NOTs with NULLs: Three-Valued Logic | p. 41 |
| Three-Valued Logic and the IN Operator | p. 42 |
| How WHERE Determines What's In and Out | p. 43 |
| Wrap Up | p. 43 |
| Reshaping Results | p. 47 |
| AS: Naming Result Table Columns | p. 47 |
| DISTINCT and ALL: Dealing with Duplicates | p. 48 |
| Derived Attributes | p. 50 |
| Numeric | p. 50 |
| Character String | p. 52 |
| Temporal | p. 57 |
| Binary | p. 59 |
| Computation in the WHERE Clause | p. 60 |
| ORDER BY: Ordering Result Table Traversal | p. 61 |
| CAST: Data Type Conversion | p. 64 |
| CASE, COALESCE, and NULLIF: Conditional Expressions | p. 66 |
| CASE: Value List | p. 66 |
| CASE: Conditional List | p. 67 |
| NULLIF | p. 69 |
| COALESCE | p. 70 |
| Wrap Up | p. 70 |
| Aggregating Results | p. 75 |
| Aggregation Functions | p. 75 |
| AVG and SUM | p. 75 |
| MIN and MAX | p. 76 |
| COUNT | p. 77 |
| Removing Rows before Aggregation with WHERE | p. 78 |
| Removing Repeating Data with DISTINCT before Aggregation | p. 79 |
| Mixing Attributes, Aggregates, and Literals | p. 79 |
| Group Aggregation Using GROUP BY | p. 80 |
| Removing Rows before Grouping with WHERE | p. 82 |
| Sorting Groups with ORDER BY | p. 83 |
| Removing Groups with HAVING | p. 83 |
| Aggregates over Expressions | p. 85 |
| Wrap Up | p. 87 |
| Joins | p. 91 |
| Two Table Joins with WHERE | p. 91 |
| Table Aliases | p. 94 |
| Joins Needing More Than Two Tables | p. 95 |
| Self-Join: Joining a Table with Itself | p. 97 |
| Example Joins | p. 97 |
| How Does a Join Really Work? | p. 99 |
| Theta Joins: Generalizing Join Predicates | p. 101 |
| JOIN Operator | p. 104 |
| Inner Join | p. 104 |
| Outer Join | p. 106 |
| Natural Join | p. 109 |
| Cross Join | p. 111 |
| Join Strategies | p. 111 |
| Wrap Up | p. 112 |
| Set Queries: UNION, INTERSECT, and EXCEPT | p. 117 |
| Union | p. 117 |
| Intersect | p. 120 |
| Except | p. 121 |
| Wrap Up | p. 124 |
| Subqueries | p. 127 |
| What Are Subqueries? | p. 127 |
| Multilevel Subquery Nesting | p. 132 |
| Subqueries Using NOT IN | p. 134 |
| Subqueries with Empty Results | p. 136 |
| Combining JOIN and Subqueries | p. 137 |
| Standard Comparison Operators with Lists Using ANY, SOME, or ALL | p. 138 |
| ANY or SOME | p. 139 |
| All | p. 142 |
| Correlated Subqueries | p. 144 |
| Exists | p. 146 |
| Derived Relations-Subqueries in the FROM Clause | p. 148 |
| Subqueries in the HAVING Clause | p. 150 |
| Subset Queries | p. 151 |
| Subset Using EXISTS and EXCEPT | p. 152 |
| Subset Using Set Cardinality | p. 155 |
| Comparing Set Cardinality and Subsets | p. 156 |
| Subqueries in the SELECT Clause | p. 157 |
| Wrap Up | p. 159 |
| Modifying Data | p. 165 |
| INSERT: Adding New Rows | p. 165 |
| INSERTing a Row with VALUES | p. 165 |
| INSERTing Multiple Rows with SELECT | p. 168 |
| DELETE: Removing Rows | p. 169 |
| UPDATE: Changing Row Values | p. 171 |
| Testing Your DELETE and UPDATE WHERE Conditions | p. 174 |
| Living within Constraints | p. 174 |
| Wrap Up | p. 176 |
| Creating, Deleting, and Altering Tables | p. 179 |
| Creating Simple Tables | p. 179 |
| DEFAULT Values | p. 180 |
| Constraints | p. 181 |
| Not Null | p. 181 |
| Unique | p. 182 |
| Primary Key | p. 183 |
| Foreign Key | p. 184 |
| Check | p. 185 |
| Naming Constraints | p. 186 |
| Creating a Table from Tables | p. 187 |
| Create Domain | p. 188 |
| Referential Actions: The Autopilot of Foreign Key Maintenance | p. 189 |
| Indexes | p. 190 |
| Create Index | p. 191 |
| Drop Index | p. 192 |
| Indexes Are NOT in SQL 2003 | p. 192 |
| Drop Table | p. 192 |
| Alter Table | p. 193 |
| Generated Values | p. 195 |
| Sequences | p. 195 |
| Global and Local Temporary Tables | p. 197 |
| Creating a Database | p. 198 |
| Wrap Up | p. 199 |
| Views | p. 205 |
| Why Views? | p. 206 |
| Querying Views | p. 207 |
| Updating Views | p. 209 |
| Drop View | p. 211 |
| Wrap Up | p. 211 |
| Transactions | p. 215 |
| Ending a Transaction-COMMIT and ROLLBACK | p. 217 |
| Starting a Transaction-START TRANSACTION | p. 217 |
| Auto-Commit | p. 218 |
| SAVEPOINTs | p. 218 |
| Immediate or Deferred Constraints | p. 219 |
| Testing Changes with Transactions | p. 221 |
| Transaction Characteristics | p. 222 |
| Locking Issues | p. 223 |
| Wrap Up | p. 223 |
| Database Privileges | p. 227 |
| Grant | p. 228 |
| Revoke | p. 230 |
| Public | p. 230 |
| Creating a Set of Privileges Using ROLEs | p. 231 |
| Using Privileges and Views | p. 232 |
| Wrap Up | p. 233 |
| Introduction to Cursors, Embedded SQL, Stored Procedures, and Triggers | p. 237 |
| CURSORs | p. 237 |
| Programming with SQL | p. 239 |
| Stored Procedures | p. 239 |
| Executing SQL in Other Programming Languages | p. 240 |
| Triggers | p. 243 |
| Create Trigger | p. 243 |
| Trigger Firing Rules | p. 245 |
| Drop Trigger | p. 245 |
| Using Triggers | p. 245 |
| Wrap Up | p. 246 |
| Index | p. 249 |
| Table of Contents provided by Ingram. All Rights Reserved. |