views:

605

answers:

10
+6  Q: 

ANSI SQL Manual

Can anyone recommend a good ANSI SQL reference manual?

I don't necessary mean a tutorial but a proper reference document to lookup when you need either a basic or more in-depth explanation or example.

Currently I am using W3Schools SQL Tutorial and SQL Tutorial which are ok, but I don't find them "deep" enough.

Of course, each major RDBMS producer will have some sort of reference manuals targeting their own product, but they tend to be biased and sometime will use proprietary extensions.

EDITED: The aim of the question was to focus on the things database engines have in common i.e. the SQL roots. But understanding the differences can also be a positive thing - this is quite interesting.

+1  A: 

The main problem with an ANSI SQL reference manual is that you can't find a DB which implements it. And when it does, then you'll find that ANSI SQL can't solve some of the daily problems. Which is why all professional databases define extensions.

So at work, you'll need a reference manual for the specific version of the database which you use.

Aaron Digulla
+2  A: 

ANSI documents can all be purchased from -- you guessed it -- ANSI.

http://webstore.ansi.org/

S.Lott
Question was about an SQL Reference. The answer therefore has to be ANSI. +1
dz
+2  A: 

Here's the ‘Second Informal Review Draft’ of SQL:1992, which seems to have been accurate enough for everything I've looked up. 1992 covers most of the stuff routinely used across DBMSs.

bobince
This looks ok - very detailed but also very technical. Nevertheless is a good reference so .. thanks!
Adrian
A: 

It's a littel outdated, but this book is really helpful is looking at how the differnt vendors implement things, I belive it includes ANSII standard.

http://www.amazon.com/SQL-Nutshell-2nd-Kevin-Kline/dp/0596004818/ref=sr%5F1%5F1?ie=UTF8&s=books&qid=1257963172&sr=8-1

HLGEM
+6  A: 

SQL isn't like C or Java, where there is a standard for the language, and then a number of companies and organizations are implementing the language as best they can, following the standard.

Instead, the major databases came before the SQL standard, and the standard is a sort of compromise where every database vendor wanted to get their particular dialect and features in the standard.

Therefore, there is much more variety between databases than between typical programming language compilers, and to use a database, you really need to know that particular SQL dialect.

Having said that, I've got Gultzan and Peltzer's SQL-99 Complete, Really here in my bookshelf. It is a good book if you need to know what the standard really contains. (And yes, there is a newer version since SQL-99, but noone seems to care.)

EDIT: Actually, there is not just one newer version since SQL-99, but three: SQL:2003, SQL:2006, and SQL:2008. And still noone seems to care. Actually, many don't even care about SQL-99, so SQL-92 is still, in a way, "the standard".

Thomas Padron-McCarthy
+1 I use the same book as my reference for standard SQL. Quite a few vendors *have* implemented features from SQL-99 and SQL:2003, so it's not like no one cares! It just takes them 10+ years to get around to it. :-)
Bill Karwin
Isn't C exactly like SQL in this way, with lots of different competing extensions before the standardization effort? (Which produced C89, so it may look *now* like everyone always followed the standard, 20 years later.)
Roger Pate
+2  A: 

I really like just about anything Joe Celko has written Celko's Books

Cape Cod Gunny
+1. Good books.
z5h
I agree Celko's books are worth reading, but they are not complete SQL reference books.
Bill Karwin
A: 

The DevGuru resources always worked well for me: http://www.devguru.com/technologies/t-sql/home.asp

Although I must admit it's not strictly an 'ANSI' focused resource. I've always been MS SQL centric, and it was helpful to me when I was starting out. IMHO Your best bet will be to use several resources - specifically including at least one of for each DB platform you want to use.

To Quote the DevGuru intro for their T-SQL resource:

Although there are standards for SQL, such as ANSI SQL92 and SQL99, most databases use their own dialect and/or extentions. Microsoft's flavor of SQL used in SQL Server 7 and SQL Server 2000 is called T-SQL. While many of the examples in this quick reference may work on other databases, it is assumed that SQL Server 2000 is used, especially for advanced topics such as stored procedures.

Adrian K
+1  A: 

This reminds me of my 2nd year university course where we learn relational theory instead of SQL.

Read a good book on Relational Theory. Database theory and practice have evolved since Edgar Codd originally defined the relational model back in 1969. Independent of any SQL products, SQL and Relational Theory draws on decades of research to present the most up-to-date treatment of the material available anywhere. Anyone with a modest to advanced background in SQL will benefit from the many insights in this book.

alt text

Oreilly January 2009

Yada
Yes it's a good book about relation database concepts and theory, but it's not an SQL language reference.
Bill Karwin
+1  A: 

I found the best way to learn SQL was to actually get to writing queries and understanding the nature of joins/conditionals etc. I found this link with a lot of DIY examples to be the best : http://sqlzoo.net/

Ritesh M Nayak
+1: although the site is a bit opaque, I've referenced sqlzoo.net often enough for DB-specific details. Good one.
BalusC
A: 

I think this may be helpful to you.

Understanding the ANSI SQL standard By: Kevin Kline

http://www.amazon.com/gp/product/1565927443/102-0105946-4028970?v=glance&n=283155

srikanth rongali