The Language of SQL, 3rd Edition

Book description

Get Started Fast with SQL!

The only book you need to gain a quick working knowledge of SQL and relational databases.

Many SQL texts attempt to serve as an encyclopedic reference on SQL syntaxan approach that is often counterproductive because that information is readily available in online references published by the major database vendors.

For SQL beginners, its more important for a book to focus on general concepts and to offer clear explanations and examples of what various SQL statements can accomplish. This is that book.

Several features make The Language of SQL unique among introductory SQL books.

First, you will not be required to download software or sit with a computer as you read the text. The intent of this book is to provide examples of SQL usage that can be understood simply by reading.

Second, topics are organized in an intuitive and logical sequence. SQL keywords are introduced one at a time, allowing you to grow your understanding as you encounter new terms and concepts.

Finally, this book covers the syntax of the latest releases of three widely used databases: Microsoft SQL Server 2019, MySQL 8.0, and Oracle 18c. Special Database Differences sidebars clearly show you any differences in syntax among these three databases, and instructions are included on how to obtain and install free versions of the databases.

  • Use SQL to retrieve data from relational databases

  • Apply functions and calculations to data

  • Group and summarize data in a variety of useful ways

  • Use complex logic to retrieve only the data you need

  • Design relational databases so that data retrieval is easy and intuitive

  • Update data and create new tables

  • Use spreadsheets to transform your data into meaningful displays

  • Retrieve data from multiple tables via joins, subqueries, views, and set logic

  • Create, modify, and execute stored procedures

  • Install Microsoft SQL Server, MySQL, or Oracle

Table of contents

  1. Cover Page
  2. About This eBook
  3. Title Page
  4. Copyright Page
  5. Contents at a Glance
  6. Table of Contents
  7. About the Author
  8. Acknowledgments
  9. Introduction
  10. 1 Relational Databases and SQL
    1. What Is SQL?
    2. Microsoft SQL Server, MySQL, and Oracle
    3. Relational Databases
    4. Primary and Foreign Keys
    5. Data Types
    6. NULL Values
    7. A Brief History of Databases
    8. Looking Ahead
  11. 2 Basic Data Retrieval
    1. A Simple SELECT
    2. Syntax Notes
    3. Comments
    4. Specifying Columns
    5. Column Names with Embedded Spaces
    6. Preview of the Full SELECT
    7. Looking Ahead
  12. 3 Calculated Fields and Aliases
    1. Literal Values
    2. Arithmetic Calculations
    3. Concatenating Fields
    4. Column Aliases
    5. Table Aliases
    6. Looking Ahead
  13. 4 Using Functions
    1. What Is a Function?
    2. Character Functions
    3. Composite Functions
    4. Date/Time Functions
    5. Numeric Functions
    6. Miscellaneous Functions
    7. Looking Ahead
  14. 5 Sorting Data
    1. Sorting in Ascending Order
    2. Sorting in Descending Order
    3. Sorting by Multiple Columns
    4. Sorting by a Calculated Field
    5. Sort Sequences
    6. Looking Ahead
  15. 6 Selection Criteria
    1. Applying Selection Criteria
    2. WHERE Clause Operators
    3. Limiting Rows
    4. Limiting Rows with a Sort
    5. Pattern Matching
    6. Matching by Sound
    7. Looking Ahead
  16. 7 Boolean Logic
    1. Complex Logical Conditions
    2. The AND Operator
    3. The OR Operator
    4. Using Parentheses
    5. Multiple Sets of Parentheses
    6. The NOT Operator
    7. The BETWEEN Operator
    8. The IN Operator
    9. Boolean Logic and NULL Values
    10. Looking Ahead
  17. 8 Conditional Logic
    1. The CASE Expression
    2. The Simple CASE Format
    3. The Searched CASE Format
    4. Conditional Logic in ORDER BY Clauses
    5. Conditional Logic in WHERE Clauses
    6. Looking Ahead
  18. 9 Summarizing Data
    1. Eliminating Duplicates
    2. Aggregate Functions
    3. The COUNT Function
    4. Grouping Data
    5. Multiple Columns and Sorting
    6. Selection Criteria on Aggregates
    7. Conditional Logic in GROUP BY Clauses
    8. Conditional Logic in HAVING Clauses
    9. Ranking Functions
    10. Partitions
    11. Analytic Functions
    12. Looking Ahead
  19. 10 Subtotals and Crosstabs
    1. Adding Subtotals with ROLLUP
    2. Adding Subtotals with CUBE
    3. Creating Crosstab Layouts
    4. Looking Ahead
  20. 11 Inner Joins
    1. Joining Two Tables
    2. The Inner Join
    3. Table Order in Inner Joins
    4. Implicit Inner Joins
    5. Table Aliases Revisited
    6. Looking Ahead
  21. 12 Outer Joins
    1. The Outer Join
    2. Left Joins
    3. Testing for NULL Values
    4. Right Joins
    5. Table Order in Outer Joins
    6. Full Joins
    7. Cross Joins
    8. Looking Ahead
  22. 13 Self Joins and Views
    1. Self Joins
    2. Creating Views
    3. Referencing Views
    4. Benefits of Views
    5. Modifying and Deleting Views
    6. Looking Ahead
  23. 14 Subqueries
    1. Types of Subqueries
    2. Subqueries as a Data Source
    3. Subqueries as Selection Criteria
    4. Correlated Subqueries
    5. The EXISTS Operator
    6. Subqueries as a Calculated Column
    7. Common Table Expressions
    8. Looking Ahead
  24. 15 Set Logic
    1. The UNION Operator
    2. Distinct and Non-Distinct Unions
    3. Intersecting Queries
    4. Looking Ahead
  25. 16 Stored Procedures and Parameters
    1. Creating Stored Procedures
    2. Parameters in Stored Procedures
    3. Executing Stored Procedures
    4. Modifying and Deleting Stored Procedures
    5. Functions Revisited
    6. Looking Ahead
  26. 17 Modifying Data
    1. Modification Strategies
    2. Inserting Data
    3. Deleting Data
    4. Updating Data
    5. Correlated Subquery Updates
    6. Looking Ahead
  27. 18 Maintaining Tables
    1. Data Definition Language
    2. Table Attributes
    3. Table Columns
    4. Primary Keys and Indexes
    5. Foreign Keys
    6. Creating Tables
    7. Creating Indexes
    8. Looking Ahead
  28. 19 Principles of Database Design
    1. Goals of Normalization
    2. How to Normalize Data
    3. The Art of Database Design
    4. Alternatives to Normalization
    5. Looking Ahead
  29. 20 Strategies for Using Excel
    1. Crosstab Layouts Revisited
    2. External Data and Power Query
    3. Excel Pivot Tables
    4. Excel Pivot Charts
    5. Excel Standard Charts
    6. Looking Ahead
  30. A Getting Started with Microsoft SQL Server
    1. Installing Microsoft SQL Server 2019 Express
    2. Installing Microsoft SQL Server Management Studio 18
    3. Using Microsoft SQL Server Management Studio 18
    4. Online Reference
  31. B Getting Started with MySQL
    1. Installing MySQL Community Server and Workbench
    2. Using MySQL Workbench
    3. Online Reference
  32. C Getting Started with Oracle
    1. Installing Oracle Database Express Edition
    2. Installing Oracle SQL Developer
    3. Using Oracle SQL Developer
    4. Online Reference
  33. Index
  34. Code Snippets

Product information

  • Title: The Language of SQL, 3rd Edition
  • Author(s): Larry Rockoff
  • Release date: December 2021
  • Publisher(s): Addison-Wesley Professional
  • ISBN: 9780137632718