Get up to speed fast with SQL, the language of databases. Bestselling author Chris Fehily teaches you just the parts of SQL that you need to know. Quick, learn-by-example lessons start with simple data retrieval and sorting, move on to filtering and grouping, and then build to more-advanced topics, including joins, subqueries, views, and transactions. Whether you're an analyst, developer, data scientist, or Microsoft Office user, you'll find straightforward, practical answers. You can download the sample database to follow along with the examples.
- Covers Oracle, Microsoft SQL Server, IBM DB2, MySQL, PostgreSQL, and Microsoft Access.
- Learn the core language for standard SQL, and variations for the most widely used database systems.
- Organize your database in terms of the relational model.
- Master tables, columns, rows, and keys.
- Retrieve, sort, and format data.
- Filter the data that you don't want to see.
- Convert and manipulate data with SQL's built-in functions and operators.
- Use aggregate functions to summarize data.
- Create complex SQL statements by using joins, subqueries, constraints, conditional logic, and metadata.
- Create, alter, and drop tables, indexes, and views.
- Insert, update, delete, and merge data.
- Execute transactions to maintain the integrity of your data.
- Avoid common pitfalls involving nulls.
- Troubleshoot and optimize queries.
- Plenty of tips, tricks, and timesavers.
- Fully cross-referenced, linked, and searchable.
2. Database Basics
3. SQL Basics
4. Retrieving Data from a Table
5. Sorting Rows
6. Filtering Rows
7. Combining and Negating Conditions
8. Pattern Matching
9. More Ways to Filter Rows
10. Operators and Functions
11. Working with Functions
12. Evaluating Conditional Values
13. Summarizing Data
14. Grouping Data
15. Joining Tables
16. Working with Joins
18. Combining Queries
19. Inserting Rows
20. Updating and Deleting Rows
21. Creating and Changing Tables
A. The Sample Database
B. Running SQL Programs
C. Data Types
About the Author
Chris Fehily is a statistician and author based in San Francisco.