[ Home ]

SQL cover

SQL Database Programming (2015 Edition)
by Chris Fehily

Download this book’s companion files.


Perfect for end users, analysts, data scientists, and app developers, this best-selling guide will get you up and running with SQL, the language of databases. You’ll find general concepts, practical answers, and clear explanations of what the various SQL statements can do. Hundreds of examples of varied difficulty encourage you to experiment and explore. Full-color SQL code listings help you see the elements and structure of the language. You can download the sample database to follow along with the author’s examples.

Prices and formats

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

Ebook ($9.99 list)
   Amazon Kindle (US, CA, UK, 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. Running SQL Programs
2. The Relational Model
3. SQL Basics
4. Retrieving Data From a Table
5. Operators and Functions
6. Summarizing and Grouping Data
7. Joins
8. Subqueries
9. Set Operations
10. Inserting, Updating, and Deleting Rows
11. Creating, Altering, and Dropping Tables
12. Indexes
14. Transactions


This book’s examples use the sample database books, described in “The Sample Database” in Chapter 2. To create books, download the zip file sql_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 Chapter 2, 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#.)