You are previewing SQL for MySQL: A Beginner's Tutorial.
O'Reilly logo
SQL for MySQL: A Beginner's Tutorial

Book Description

This introduction to SQL for MySQL begins by discussing exactly how data is stored and maintained in a relational database, familiarizing readers with SQL INSERT, UPDATE, and DELETE statements. The guide then discusses how to construct basic queries, choose an appropriate output, and how to create and use groups. Readers will also learn how to use joins to query data from multiple tables, how to create predefined views that can be stored in a database, and how to utilize the metadata of a database. Appendices round out the book, covering the various indexing techniques available in MySQL and discussing how to install MySQL Community Edition and list the MySQL built-in data types. 

Table of Contents

  1. Introduction
    1. SQL Overview
    2. About This Book
    3. Code Conventions
    4. Code Download
  2. Chapter 1: Storing and Maintaining Data
    1. Creating and Selecting A Default Database
    2. Creating a Table
    3. Adding Data
    4. Updating Data
    5. Deleting Data
    6. Summary
  3. Chapter 2: Basic Queries
    1. The SELECT statement
    2. Querying All Data
    3. Selecting Specific Columns
    4. Selecting Rows with WHERE
    5. Compound Conditions
    6. Evaluation Precedence and the Use of Parentheses
    7. The NOT logical operator
    8. The BETWEEN Operator
    9. The IN Operator
    10. The LIKE Operator
    11. Escaping the Wildcard Character
    12. Combining the NOT operator
    13. Summary
  4. Chapter 3: Full-Text Search
    1. Natural Language Searches
    2. Query Expansion Searches
    3. Boolean Searches
    4. Summary
  5. Chapter 4: Query Output
    1. Column Aliases
    2. Expressions
    3. Limiting the Number of Rows
    4. The DISTINCT Keyword
    5. Aggregate Functions
    6. The CASE Expression
    7. Ordering Output Rows
    8. Storing Query Output
    9. Summary
  6. Chapter 5: Grouping
    1. The GROUP BY Clause
    2. The HAVING Keyword
    3. Summary
  7. Chapter 6: Joins
    1. Primary Keys and Foreign Keys
    2. Querying Multiple Tables
    3. Using Table Aliases
    4. Joining More than Two Tables
    5. The Outer Join
    6. Self-Joins
    7. Multiple Uses of A Table
    8. Natural Joins
    9. Summary
  8. Chapter 7: Subqueries
    1. Single-Row Subqueries
    2. Multiple-Row Subqueries
    3. Multiple Nested Subqueries
    4. Correlated Subqueries
    5. Summary
  9. Chapter 8: Compound Queries
    1. UNION ALL
    2. UNION
    3. Summary
  10. Chapter 9: Views
    1. Creating and Using Views
    2. Nested Views
    3. Managing Views
    4. Summary
  11. Chapter 10: Built-in Functions
    1. Numeric Functions
    2. ROUND
    3. SIGN
    4. TRUNC
    5. Character Functions
    6. Datetime Functions
    7. NULL-related functions
    8. Summary
  12. Chapter 11: Transactions
    1. Overview
    2. SAVEPOINT
    3. AutoCommit
    4. Summary
  13. Chapter 12: Stored Routines
    1. Row-by-row Processing
    2. If-Then-Else Decision Logic
    3. Exception Handling
    4. User-defined Functions
    5. Transactions
    6. Summary
  14. Chapter 13: The Data Dictionary
    1. The Schemata Table
    2. The Tables Table
    3. The Columns Table
    4. The Routines Table
    5. Summary
  15. Appendix A: Installing MySQL Community Edition
    1. Downloading MySQL Community Edition
    2. Installing MySQL Community Edition
  16. Appendix B: MySQL Built-in Data Types
  17. Appendix C: Indexes
    1. Creating an Index
    2. Multi-Column Indexes
    3. Unique Indexes
    4. Partial Indexes
    5. Primary Key Indexes
    6. Deleting An Index