News for hackers. Stuff that matters.
Re:A beginners guide to thinking in SQL by filereaper on Monday July 11, 2016 @05:10PM (#12074670)
What's the canonical reference book one should go to regarding SQL? (ie K&R is the book you go to for C)

I understand there are differences between DB vendors, but my question is about general patterns and best practices.

Re:A beginners guide to thinking in SQL by stevecalifornia on Monday July 11, 2016 @05:21PM (#12074781)
SQL Pocket Guide. Thin, small book. No fluff. Just syntax and solutions for all the major vendors. If I could only have one book while developing it would be this one.

https://www.amazon.com/SQL-Pocket-Guide-Jonathan-Gennick/dp/...

Re:A beginners guide to thinking in SQL by crdb on Monday July 11, 2016 @09:24PM (#12076105)
Chris Date's Introduction to SQL [1], or Edgar Codd's last book [2].

Actually both are worth reading to discuss differences in philosophy (e.g. "no NULLs" vs 4-valued logic including "unknown" and "not applicable" NULLs).

[1] https://www.amazon.com/Introduction-SQL-Mastering-Relational...

[2] https://www.amazon.com/Relational-Model-Database-Management-...

Re:A beginners guide to thinking in SQL by qilo on Tuesday July 12, 2016 @06:12AM (#12077890)
First book [1] is not by C. J. Date. So, is this the book you recommend and just mixed up the author's name, or... ?
Re:A beginners guide to thinking in SQL by crdb on Tuesday July 12, 2016 @11:35AM (#12079891)
Good catch. Too late to edit the comment.

Yes, I meant C.J. Date's "Introduction to SQL".

I was trying to get a link to the latest edition which appeared to be the 2nd link on an Amazon search for "Date introduction to SQL"... anyway, it is continuously edited so it's worth seeking the latest version which has twice as many pages as some of the earlier ones.

Re:A beginners guide to thinking in SQL by qilo on Tuesday July 12, 2016 @04:55PM (#12082224)
The thing is, and I probably should have pointed it out in the first comment, sorry about that: I can't find such a book by Cris Date. My guess is you meant "Introduction to Database Systems".
Re:A beginners guide to thinking in SQL by crdb on Tuesday July 12, 2016 @08:46PM (#12083290)
Yes, you are right. Database Systems.
Re:A beginners guide to thinking in SQL by sauce71 on Monday July 11, 2016 @05:17PM (#12074733)
Joe Celko's "SQL for Smarties" ... and then the other SQL books by Celko
Re:A beginners guide to thinking in SQL by matwood on Monday July 11, 2016 @05:20PM (#12074774)
Great book! Also, go read jOOQs blog: https://blog.jooq.org/
Re:A beginners guide to thinking in SQL by combatentropy on Tuesday July 12, 2016 @02:04AM (#12077030)

  > What's the canonical reference book
  > one should go to regarding SQL?
  > (ie K&R is the book you go to for C)
  > 
  > I understand there are differences between DB vendors,
  > but my question is about general patterns and best practices.
For 10 years I've looked and never found one. I find Chris Date pedantic. The rest are a mish-mash of cookbooks, vendor-specific ones, and some that try to be the general guide you're looking for but collapse beneath the weight of hundreds of pages of prose that seems to have been written by a committee of robots.
Re:A beginners guide to thinking in SQL by a-saleh on Tuesday July 12, 2016 @03:55AM (#12077434)
As far as I know, you are probably looking for Jeffrey D. Ullman [1]? I think my lecturer at my local university basically stole [2] when he taught our course :)

Just be aware that he is an academic, so I might compare him more to A.S.Tanenbaum than K&R :-)

[1] http://infolab.stanford.edu/~ullman/ [2] http://infolab.stanford.edu/~ullman/dscb.html#slides

Re:A beginners guide to thinking in SQL by hackits on Monday July 11, 2016 @10:09PM (#12076271)
I found that basic courses on relational algebra more useful than most text books. They seem to introduce the mathematics in a more clear concise way than most SQL books.
Re:A beginners guide to thinking in SQL by sn9 on Wednesday July 13, 2016 @09:41PM (#12091154)
Not a book, but Stanford's Intro to Databases by Jennifer Widom is offered for free online and I've heard nothing but great things about it.

https://lagunita.stanford.edu/courses/DB/2014/SelfPaced/abou...

Re:A beginners guide to thinking in SQL by plasticsyntax on Wednesday July 13, 2016 @08:45AM (#12085694)
I found SQL Antipatterns by Bill Karwin to be a great book on the topic of patterns and best practices with SQL. As a bonus, it's relatively platform agnostic if I recall correctly.