It was pointed out to me yesterday that I need to get a book on SQL and learn about it properly. That is probably a fair assessment; I'm a functioning SQL programmer who can in general extract from the database the information that is needed, but as soon as extracting the data needs more than a couple of joins and a where clause the query that I come up with is probably not as good as it could be.

Previously I was working at an Oracle shop where there were a few very good SQL programmers who would generally design the more complex queries and would be on hand to answer questions, but now I'm at a SQL Server shop where no one really has much of a clue about SQL and so I feel like I need to get my skills up.

What I'm looking for is a book that is fairly short and very practical that I can work through in the evenings with a series of difficult SQL problems and then well explained solutions along with a few pieces of sage advice that is aimed at a programmer who can "do SQL" who wants to become more of a "SQL programmer". I appreciate that many things about SQL are platform dependent, so since I'm currently in a SQL Server shop then my preference would be for a book aimed at TSQL.

Any suggestions?

  • You make it sound like SQL Server folks are not real programmers. Just because something is not a royal pain in the arse ... – Job Apr 24 '11 at 3:25
  • That is not what I'm saying at all. Actually I think I'm saying the exact opposite. IMO SQL programming, or if you prefer learning to write SQL correctly, is a specialism that is all to often ignored by professional programmers, but it is critical to the job as most enterprise apps are data driven apps. And I think SQL is something that is very tough to master. – user23157 Apr 24 '11 at 9:03

I highly recommend this book: SQL Cookbook I think it's what you're looking for, it describes common situations that come up (in question and answer form) and is really geared to programmers who have basic knowledge of T-sql but want to go further.


I would suggest an electronic book so you can have a copy at work for reference (search) and at home for study. Apress has a wide selection. Get an advanced book. Any concepts you don't understand can be found on the internet (Easier to search when you know what to look for.).

http://ask.sqlservercentral.com/ not only has the QA of SO, but has articles and other how-tos specific to sql server.


I would like to recommend these 3 books authored by Itzik Ben-Gan:

  1. Microsoft® SQL Server® 2008 T-SQL Fundamentals (PRO-Developer)
  2. Inside Microsoft® SQL Server® 2008: T-SQL Querying
  3. Inside Microsoft® SQL Server® 2008: T-SQL Programming (Pro-Developer)

I would recommend to read the 1st book to obtain better overview of the various T-SQL syntax and their usages. Subsequently read the 2nd book to have a better understanding in how to use those T-SQL syntaxes.

The explanation is great, the examples are clear enough for us to follow. The 1st book offer many examples in how to use T-SQL combined with the practice examples.