Head First SQL

Head First SQL

2008 Jolt Productivity Award Winner!

Is your data dragging you down? Are your tables all tangled up? Well we've got the tools to teach you just how to wrangle your databases into submission. Using the latest research in neurobiology, cognitive science, and learning theory to craft a multi-sensory SQL learning experience, Head First SQL has a visually rich format designed for the way your brain works, not a text-heavy approach that puts you to sleep.

Maybe you've written some simple SQL queries to interact with databases. But now you want more, you want to really dig into those databases and work with your data. Head First SQL will show you the fundamentals of SQL and how to really take advantage of it. We'll take you on a journey through the language, from basic INSERT statements and SELECT queries to hardcore database manipulation with indices, joins, and transactions. We all know "Data is Power"—but we'll show you how to have "Power over your Data". Expect to have fun, expect to learn, and expect to be querying, normalizing, and joining your data like a pro by the time you're finished reading!

A collection of images from inside the book.

SQL Hands-On

Even if you don't have access to an RDBMS (Relational Database Management System), you can still practice SQL queries on tables from the book at Head First Labs. Check it out!

Read Me: What you should know before reading this book

We begin by teaching basic SQL syntax, then SQL database design concepts, and then advanced querying.

While it's important to create well-designed tables and databases, before you can, you need to understand the syntax of SQL. So we begin by giving you SQL statements that you can actually try yourself. That way you can immediately do something with SQL, and you will begin to get excited about it. Then, a bit later in the book, we show you good table design practices. By then you'll have a solid grasp of the syntax you need, and can focus on learning the concepts.

We don't cover every SQL statement, function, or keyword.

While we could have put every single SQL statement, function, and keyword in this book, we thought you'd prefer to have a reasonably liftable book that would teach you the most important statements, functions, and keywords. We give you the ones you need to know, the ones you'll use 95 percent of the time. And when you're done with this book, you'll have the confidence to go look up that function you need to finish off that kick-ass query you just wrote.

We don't address every flavor of RDBMS.

There's Standard SQL, MySQL, Oracle, MS SQL Server, PostgreSQL, DB2, and quite a few more RDBMSs out there. If we covered every variation in syntax for every command in the book, this book would have many more pages. We like trees, so we're focusing on Standard SQL with a nod toward MySQL. All the examples in the book will work with MySQL. And most will work with any of the RDBMSs listed above. Remember that reference book we just suggested you buy? Buy one for the particular RDBMS that you use.


Individual tables:

Selected Review Quotes

"On a Sunday, a fellow user-group member suggested I learn SQL. The next day, an opportunity to review Head First SQL arrived in my email. Who was I to question? Prior to opening the couriered package, I had no knowledge of SQL, I knew databases were important, and I had seen the Head First website once or twice. Now, I can design and create databases, use mySQL databases, and understand questions and accompanying code posted to forums. The credit goes to Head First SQL's style, which introduces small bits of information, supported through multiple channels (such as photos with humorous dialogue, stick-men and stick-women, and input from critical personalities whose photos and input pop up throughout the book) regular tests and exercises so the new bit of data can find a home and settle into your memory. The regularly tested pieces of information are now in my brain so I don't have to look up the basic stuff."
"This book is a must have for anyone that's just getting in to the database application development field and a very nice addition for those of us that need to reference information on SQL language how-to's... Just about everyone in the development field knows how to do simple queries such as INSERT, UPDATE, DELETE and SELECT, but while this book covers the simple SQL statements, it also takes you beyond into sub queries, joins and transactions, keeping everyone from the novice to the hard nosed professional happy."
"Now and then I discover a teacher or a leader who is truly inspired; a product that evokes creativity; or a book that conveys its subject with an approach that is thoroughly unique. Head First SQL is just that kind of book.
And how is this miracle of pedagogy accomplished?... The book is filled with illustrations, lots of white space, and eye-catching text. Humor and a light touch is rarely absent. Most importantly, the essential ideas are presented in small easy-to-grasp chunks, presented at just the right time.
Good writing never happens by accident. The book's philosophy of "metacognition" (as the editors call it) explained in the introduction. And the implementation of these subtle educational ideas is flawless. The book never leaves you wondering "what's going on here?". The book just works."
(opens a new window)

Read it on Safari

(opens a new window)

Buy 2 books, get 1 free!

Buy 2 books and get the third free! Use the coupon code OPC10 when you check out.

Jolt 2008

Head First SQL took home a Productivity Award in the Technical books category.

O'Reilly Radar took the top award in the Web Sites category and Beautiful Code in the General Books category. The Myths of Innovation and Safari Books Online also won Productivity awards in their categories.

Who is this book for?

If you can answer "yes" to all of these:

  • Do you have access to a computer with an RDBMS installed on it, like Oracle, MS SQL, or MySQL? Or one that you can install MySQL, or other RDBMS on?
  • Do you want to learn, understand, and remember how to create tables, databases, and write queries using the best and most recent standards?
  • Do you prefer stimulating dinner party conversation to dry, dull, academic lectures?

You should probably back away from this book if you can answer "yes" to any of these:

  • Are you completely comfortable with beginning SQL syntax and seeking something that will help you with advanced database design? (But if you would like a refresher, and never quite understood normal form and one-to-many and left outer joins, this book can help you.)
  • Are you an experienced SQL programmer looking for a reference book on SQL?
  • Are you afraid to try something different? Would you rather have a root canal than mix stripes with plaid? Do you believe that a technical book can't be serious if SQL concepts are anthropomorphized?


Ask the authors questions and chat with fellow readers in the Head First SQL Forum.