[ Home ]

SQL Short Course cover

SQL Short Course
by Chris Fehily

Download this book’s companion files.


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.

Prices and formats

Paperback ($14.99 list)
   Amazon paperback (US, UK, FR, DE, ES, IT)

Ebook ($5.99 list)
   Amazon Kindle (US, CA, UK, AU, FR, DE, ES, IT, JP, BR)
   Apple iBooks (US, CA, MX, AU, NZ, UK, IE, DE, IT, SE, NL, DK, JP, BR, more)
   Barnes & Noble Nook
   Google Play


1. Introduction
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
17. Subqueries
18. Combining Queries
19. Inserting Rows
20. Updating and Deleting Rows
21. Creating and Changing Tables
22. Indexes
24. Transactions
A. The Sample Database
B. Running SQL Programs
C. Data Types


This book’s examples use the sample database books, described in “The Sample Database” in Appendix A. To create books, download the zip file sql_short_course_files.zip, expand it, and follow the instructions for your DBMS, listed below. The file readme.txt describes the distribution.

In addition to creating the tables described in “The Sample Database” in Appendix A, the SQL scripts create additional tables used in other examples. If you’re running a DBMS locally (that is, on your own computer), then you’re the database administrator (DBA) and have all the privileges you need. If you’re connecting to a DBMS on a network server, then ask your DBA for connection parameters and the privileges to create, query, update, and drop databases and tables.

The instructions for creating the sample database explain how to use simple tools and settings. As you gain experience, you might want to switch to using the statement CREATE DATABASE to create new databases. CREATE DATABASE is a powerful but nonstandard SQL command, so its syntax and capabilities vary by DBMS; see your DBMS’s documentation. (Microsoft Access doesn’t support CREATE DATABASE, but you can create Access databases programmatically by using Visual Basic for Applications or C#.)