Newbie to SQL - Experienced Programmer looking for Book Review

  • I have programmed for over 20 years with some exposure to Java, SQL and VB but need to delve further into the SQL world. As I am a motivated learner with a good analytical mind, I am looking for a good book to start learning some advanced SQL techniques - Anyone have any reviews - Good, Bad or Indifferent?

  • First, you must realize that SQL is NOT SQL... most books on SQL I've seen rely on supposed advanced techniques using ANSI SQL.  Others are based more on what Oracle has to offer (or, I should say, doesn't have to offer ).  I think, given your years of experience with SQL, you will be sorely disappointed with just about any book you buy.  I know I have... and I've been programming in one form or another since 1968 (Good Grief, eh?).  My first program was "written" by punching banana-plug wires into a wiring board on unit record equipment.

    For an example of my relative level of disgust with such books... In my early years with MS-SQL Server (I didn't have the web as available as I do now), I bought and desparately searched several supposed "advanced" SQL books for a way to delete all but the latest "dupe" for all records in a table.  I even took a $2,000 advanced course on SQL just to find things like that out.  All of the books and all the instructors all said the same lousy thing... "If you've done everything right, you won't have any dupes in your table."  It was the correct but still useless answer.  But, I digress...

    If you want to learn some really advanced SQL techniques, the first thing you must do is decide with RDBMS you want to get good at because, like I said, SQL is NOT SQL.  For example, MS-SQL Server has an incredibly useful UPDATE statement that has 2 FROM clauses... beats the heck out of using correlated subqueries like most RDBMS's require you to use.  And that same update can also update both a variable and a column using a 3 part expression.  I don't know of any other RDBMS that can do that in a set based fashion (now THERE's something you may need to learn... SET BASED!!)  The point is that most of the advanced functionality of any RDBMS is dependent on the "extensions" that a company puts into their product above and beyond the ANSI dribble.

    Once you've decided which one (or two but I recommend just one to start) that you really want to learn advanced techniques for, you need to cuddle up with the documentation for the product.  The first thing to look for is, are there any special things in the basic statements of SELECT, INSERT, UPDATE, or DELETE that you need to be aware of like those I previously described?  The second thing is to hunt down all of the functions and learn them all.  Functions are the life of advanced SQL.

    Finally, find a good forum, like this one, and start doing searches for how to do different things.  You can do the same thing on the web but you'll likely get more correct answers (some ARE really garbage) from a trusted forum.

    The documentation for SQL Server (T-SQL) comes with the product and is called "Books Online".  It's really the only "book" that you need.  The rest is going to be all you so it's good that you're tenatious.

    The really great part about this forum is that if you get stuck on something "advanced" and can't find it by searching the forum or articles in the site, ask the forum (the T-SQL forum is usually the most visited and is the place I think you should probably ask your questions).  You will get at least one answer and, knowing the clientel on this forum, you will likely get more than one good answer.  Like any place else, including books written with much diatribe and zeal, you will also get bad answers.  You'll be able to tell which is which very soon.  And, if you really want to learn advanced techniques, try solving some of the other peoples' questions... you will simply be amazed at how fast a little practice on some of the fasinating questions people come up with will turn you into an expert.

    For example... one of the latest problems I solved seemed simple, at first... given the following information, pull out the 2 page numbers (x and y of "page x of y") from the following list of filenames... try it out on your own...

    Watch_pg1of2_812006.csv'

    Watch_pg1of20_812006.csv'

    Watch_pg10of20_812006.csv'

    Watch_pg1of999_812006.csv'

    Watch_pg20of999_812006.csv'

    Watch_pg900of999_812006.csv'

    I've been working with SQL Server for 11 years (databases for about 26) and, although I've done similar things, I've never done THAT thing.  I taught myself another "advanced" technique.

    If you're interested, the answer I gave is at the following URL... you can see why I say you simply must become an expert at the use of all instrinsic functions...  I tried several methods, as did others, before I came up with what I thought was the best possible answer...

    http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=9&messageid=305956#bm306155

    So, the long and short of it is, if you really want advanced SQL techniques, I wouldn't waste my money on books.  But that's just my opinion...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • p.s.  Forgot to mention that the 812006 in the file names can change...   I just assumed that the "Watch" prefix could change, as well.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • For SQL Server 2000

    Advanced Transact-SQL for SQL Server 2000 by Itzik Ben-Gan and Tom Moreau, PhD

    Professional SQL Server 2000 Programming by Robert Vieira

    the 2005 version of his book is late

    For SQL Server 2005

    Inside Microsoft SQL Server 2005: T-SQL Querying

    complete with logic puzzles

     

     

     

     

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply