CopyrightIntroductionAbout SQLAbout This BookWhat You'll Need Chapter 1. DBMS SpecificsRunning SQL ProgramsMicrosoft AccessMicrosoft SQL ServerOracleIBM DB2MySQLPostgreSQL Chapter 2. The Relational ModelTables, Columns, and RowsPrimary KeysForeign KeysRelationshipsNormalizationThe Sample Database Chapter 3. SQL BasicsSQL SyntaxSQL Standards and ConformanceIdentifiersData TypesCharacter String TypesBinary Large Object TypeExact Numeric TypesApproximate Numeric TypesBoolean TypeDatetime TypesInterval TypesOther Data TypesNulls Chapter 4. Retrieving Data From a TableRetrieving Columns with SELECT and FROMCreating Column Aliases with ASEliminating Duplicate Rows with DISTINCTSorting Rows with ORDER BYFiltering Rows with WHERECombining and Negating Conditions with AND, OR, and NOTMatching Patterns with LIKERange Filtering with BETWEENList Filtering with INTesting for Nulls with IS NULL Chapter 5. Operators and FunctionsCreating Derived ColumnsPerforming Arithmetic OperationsDetermining the Order of EvaluationConcatenating Strings with ||To concatenate stringsExtracting 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 ArithmeticGetting the Current Date and TimeGetting User InformationConverting Data Types with CAST()Evaluating Conditional Values with CASEChecking for Nulls with COALESCE()Comparing Expressions with NULLIF() Chapter 6. Summarizing and Grouping DataUsing Aggregate FunctionsCreating Aggregate ExpressionsFinding 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 DISTINCTGrouping Rows with GROUP BYFiltering Groups with HAVING Chapter 7. JoinsQualifying Column NamesCreating Table Aliases with ASUsing JoinsCreating Joins with JOIN or WHERECreating a Cross Join with CROSS JOINCreating a Natural Join with NATURAL JOINCreating an Inner Join with INNER JOINCreating Outer Joins with OUTER JOINCreating a Self-Join Chapter 8. SubqueriesUnderstanding SubqueriesSubquery SyntaxSubqueries vs. JoinsSimple and Correlated SubqueriesQualifying Column Names in SubqueriesNulls in SubqueriesUsing Subqueries as Column ExpressionsComparing a Subquery Value by Using a Comparison OperatorTesting Set Membership with INComparing All Subquery Values with ALLComparing Some Subquery Values with ANYTesting Existence with EXISTSComparing Equivalent Queries Chapter 9. Set OperationsCombining Rows with UNIONFinding Common Rows with INTERSECTFinding Different Rows with EXCEPTCalculating Running StatisticsGenerating SequencesFinding Sequences, Runs, and RegionsLimiting the Number of Rows ReturnedAssigning RanksCalculating a Trimmed MeanPicking Random RowsHandling Duplicates Chapter 10. Inserting, Updating, and Deleting RowsDisplaying Table DefinitionsInserting Rows with INSERTUpdating Rows with UPDATEDeleting Rows with DELETE Chapter 11. Creating, Altering, and Dropping TablesCreating TablesUnderstanding ConstraintsCreating a New Table with CREATE TABLEForbidding Nulls with NOT NULLSpecifying a Default Value with DEFAULTSpecifying a Primary Key with PRIMARY KEYSpecifying a Foreign Key with FOREIGN KEYForcing Unique Values with UNIQUEAdding a Check Constraint with CHECKCreating a Temporary Table with CREATE TEMPORARY TABLECreating a New Table from an Existing One with CREATE TABLE ASAltering a Table with ALTER TABLEDropping a Table with DROP TABLE Chapter 12. IndexesCreating an Index with CREATE INDEXDropping an Index with DROP INDEX Chapter 13. ViewsCreating a View with CREATE VIEWRetrieving Data Through a ViewUpdating Data Through a ViewDropping a View with DROP VIEW Chapter 14. TransactionsExecuting a Transaction Appendix A. Creating the Sample DatabaseCreating the Sample Database Appendix B. SQL KeywordsIndex