Slashdot Mirror


Learning SQL on SQL Server 2005

khorner writes "I joined a local XP User Group in May of this year. As the IT Manager of Application Development for a 90+ year old agricultural cooperative, I'm introducing the concepts of agile development and need the support. Right off the bat, we've acquired some review copies of books and I volunteered for the O'Reilly book: Learning SQL on SQL Server 2005. I have been working with various versions of Microsoft SQL Server since 1999, so I figured I could give it a go." Read the rest of Kevin's review. Learning SQL on SQL Server 2005 author Sikha Saha Bagui & Richard Walsh Earp pages 325 publisher O'Reilly rating 4 reviewer Kevin Horner ISBN 0596102151 summary The organization and inconsistencies take away from the value of the book as a whole

Historically, I've found the O'Reilly books to be great references for professional programmers. I began with David Flanagan's Javascript: The Definitive Guide -- I think it was the 3rd edition. I enjoyed them for their reference value as well as business-oriented examples. Learning SQL on SQL Server 2005 does not, in my opinion, follow the mold I have become accustomed to from O'Reilly.

Learning SQL on SQL Server 2005 covers many of the topics necessary to introduce relational databases to the beginner. It is based on the authors' university course curriculum and it is evident with the review questions including with each chapter.

The authors cover important topics at an adequate depth for its target audience; however the organization needs some work. The first six chapters flip-flop across what I consider to be logical boundaries in a discussion on database development: schema versus data. Tools are a platform dependent subject necessary to discuss implementation.

The database provided could use some refactoring to get to a more cohesive and production level design. Not to be nitpicking, but as an example, equivalent domain level attributes for example, student number, are represented across tables as different column names. This is the attention to detail that drives me nuts on the professional level.

Chapter 1 sets the tone by touching multiple concepts and incorporates a smothering of screenshots. Over the first 25 pages (half being images and query result tables) we load the demo database, modify it, select from it, and cover to the Management Studio's syntax color coding and customization. Quite a lot to start off with for a novice, all with the assumption MS SQL 2005 is installed and ready to go.

Chapter 2 jumps into simple data selection of a single table and briefly hits the new MS SQL 2005 concept of synonyms.

Chapter 3 tries to focus on the schema oriented topic of table creation but falls short when jumping over to data topics like INSERT, UPDATE and DELETE. There is good coverage of data types, but we don't cover any design concepts of why we create tables and considerations for doing so. To the authors' defense, they state this is not a book on theory, but I think some level of theory is an important aspect to learn SQL.

Chapter 4 introduces the data selection concept of table joins and to do so, introduces the schema concept of keys.

Chapter 5 provides good coverage on internal functions for strings and dates and sets the foundation for more advanced queries.

Chapter 6 takes the reader through a logical process of developing a complex query. This is a good example process of taking a simple query and developing it further to satisfy a business need. Unfortunately, we experience some more inconsistency when we develop a join query using the WHERE clause - an inefficient and undesirable method the authors' discussed in chapter 4. Again, we jump from data concepts to schemas when we hit views and temp tables.

Chapter 7 through 10 present set operations, sub queries, and aggregate functions in a progressively logical manner. It would have been nice to have this progression prior to Chapter 6 and incorporate the concepts in the query development.

Chapter 11 throws in a thin coat of an introduction to table indexes and constraints: the final jump across topics.

Overall, the book provides an introduction to SQL topics. In my opinion, the organization and inconsistencies take away from the value of the book as a whole. If SQL is your profession (or you want it to be), with a list price of $44.99, Celko's SQL for Smarties is the better investment.

You can purchase Learning SQL on SQL Server 2005 from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

22 of 142 comments (clear)

  1. You poor soul. by Anonymous Coward · · Score: 5, Funny
    I joined a local XP User Group in May of this year.

    Desperation leads some people to do strange things.

    1. Re:You poor soul. by tobiasly · · Score: 2, Funny

      I joined a local XP User Group in May of this year.

      Desperation leads some people to do strange things.

      I read that more along the lines of a meth users group. The kind where you have to stand up at the first meeting and admit in front of everyone, "my name is Kevin, and I'm a Windows XP user."
  2. SQL apis suck. by aersixb9 · · Score: 2, Interesting

    Why does the API for the databases suck so much? I've been using ADO.net with C# .NET 2.0 on SQL 2005, and why must I use the arcane and shitty SQL language to save my web objects in a datafile? Isn't there an option somewhere between writing 25 lines of SQL code for each action for each object (either in code or in a SPROC), and managing the files myself on the local HD, which most webhosts won't allow? How about a nice simple DBObject that my other objects can inherit from, that provides a nice 'SaveAllInTable(String table)' method, that replaces the INSERT INTO VALUE for each )*(&%# variable in my object? (and other similar SQL wrapper methods...I guess I could write that, but it would be a PITA, and that's what APIs are for, anyways!) Unless there's a good C# SQL wrapper that I don't know about...the datatable and datagrid isn't useful for anything more than displaying a raw table, something that a webapp usually shouldn't do, anyways...Of course, streamreader and streamwriters aren't much better, perhaps we need a good shared file i/o api that's better than SQL?

    1. Re:SQL apis suck. by CastrTroy · · Score: 4, Informative

      It's called a database abstraction layer. You have to build your own objects that support saving themselves to the database. It's not as much work as it sounds like, and will actually save you a lot of trouble in the long run.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    2. Re:SQL apis suck. by Kunta+Kinte · · Score: 2, Informative

      ...why must I use the arcane and shitty SQL language to save my web objects in a datafile?

      Because you are retrieving the data from an SQL Database?

      As others have pointed out, there are many ways to do this. Another method that may work for you, depending on your situation, is the server's XML capabilities, eg. "SELECT ... FOR XML ..." will convert your dataset to XML that you can easily serialize.

      --
      Based on upvotes, Ageism is the only "-ism" Slashdotters care about and think isn't SJW
    3. Re:SQL apis suck. by killjoe · · Score: 2, Informative

      Microsoft is philosophically opposed to ORM layers. That's why they have never provided one with ODBC, ADO, DMO, .NET or whatever TLA they ever came out with. MS believes that you should use stored procs for pretty much everything. For example when they re-did petshop they loaded the entire thing with stored procs because it provided faster performance.

      --
      evil is as evil does
    4. Re:SQL apis suck. by eggsovereasy · · Score: 2, Interesting

      How about you write a stored procedure to update your "Order" object (or whatever), then put a method in your Order class that calls said stored procedure then you just.. Order.X = X; Order.Y = Y; Order.Z = Z; Order.Update(); And its done. You write one stored procedure and the one method in Order and you can update everywhere easily.

    5. Re:SQL apis suck. by Jerf · · Score: 4, Interesting
      Why does the API for the databases suck so much?
      SQL is now my canonical example of a "Good Enough" technology, which holds back any sort of improvement because there's no fast and easy way to make something immediately obviously better, even though it'd probably be really easy to make something that would be better over the medium or long term. Unfortunately, new technology needs that snappy I couldn't do that before! demo to really take off. (Most recent example: Ruby on Rails. And I say that as someone who isn't really a Ruby fan.)

      The beginnings of SQL date back to the 1970s, and even in modern times it shows. People hadn't yet figured out how to deal with "NULL"s in any reasonable manner, and SQL has the dumbest NULL in any language I know of that is still in common use. People still thought empty lists were something exceptional, so "SomethingID IN ()" is an error, at least in the DBs I use, instead of a clause so obviously false the optimizer ought to positively jump for joy when it sees it. The syntax is fruity and unforgiving by modern standards, and the actual relational stuff that is supposed to underlie it all continues to be masked by the performance limitations in place in the 1970s; performance hacks now enshrined as the One Right Way to do things.

      SQL sucks, because so much effort has been invested into it that no possible fix to it could ever get traction, and SQL is so wrong that trying to bend your new system to be backwards compatible with it will probably break your new system. The only hope we have is a brand new paradigm, and frankly those haven't been faring too well either, so far. But hope springs eternal.

      Someday this mess will be resolved, but your guess is as good as mine as to which direction it's going to come from. SQL-the-language sucks, but it still manages to set the bar pretty high for any sort of technology to replace it, even just as a language-switchout on an existing DB server. (I mean something actually not SQL, not SQL adapted to Yet Another Procedure Language or SQL adapted with Yet Another Proprietary Extension.)
    6. Re:SQL apis suck. by dividius · · Score: 2, Interesting

      "why must I use the arcane and shitty SQL language to save my web objects in a datafile"

      - You musn't, get one of the half-dozen ORM's people have built for you. Some are even *gasp* open source. *Shhhhhh, don't tell anyone.

      "the datatable and datagrid isn't useful for anything more than displaying a raw table, something that a webapp usually shouldn't do, anyways"

      - Um... a brochure-ware web site doesn't usually, but a web app??!? I'm thinking... a table showing shopping cart items, a table showing employees, a table of properties in your neighboorhood, a ... surely you get the idea by now? Your misunderstanding stems from the word raw. (Not that I am standing on the mountaintop proclaiming the datatable the one true way.)

    7. Re:SQL apis suck. by computational+super · · Score: 4, Funny
      the server's XML capabilities, eg. "SELECT ... FOR XML ..." will convert your dataset to XML

      Ah, good. I've been waiting for a long time for somebody to relieve me from the mind-boggling complexity of inner joins, subselects, triggers, referential integrity rules and stored procedures by adding DOM, XSLT, XPath, DTD and XmlSchema on top of inner joins, subselects, triggers, referential integrity rules and stored procedures.

      --
      Proud neuron in the Slashdot hivemind since 2002.
  3. Re:How Qualified? by Bogtha · · Score: 3, Insightful

    He might not be the target audience, but how would you expect a member of the target audience to pick up technical errors in a book such as this?

    If it, say, taught you how to do something in a totally non-standard way that only worked on SQL Server when the standard way worked just as well, then I'd consider that to be a pretty big failing in a book like this. But somebody just beginning with SQL wouldn't have a chance of spotting something like that.

    --
    Bogtha Bogtha Bogtha
  4. What vendor? by GigsVT · · Score: 2, Funny

    Many different vendors make DBMS services that speak SQL.... What product is this talking about?

    --
    I've had enough abrasive sigs. Kittens are cute and fuzzy.
    1. Re:What vendor? by TrappedByMyself · · Score: 5, Funny

      Many different vendors make DBMS services that speak SQL.... What product is this talking about?

      I'm not sure, but the few dozen or so references to "SQL Server 2005" makes me believe it's talking about SQL Server 2005.
      I could be wrong though.

      --

      Help me take back Slashdot. When did 'News for Nerds' become 'FUD and Conspiracy Theories for Extremist Nutjobs'?
  5. Re:How Qualified? by Bake · · Score: 3, Insightful

    And this is different from the numerous MySql books that get reviewed here, how exactly?

    If anything SQL Server behaviour is a lot closer to that of Oracle and PostgreSQL (and possibly DB2, I don't know) than MySql can ever hope to achieve!

  6. that's what I thought by garyrich · · Score: 3, Insightful

    when he said this:

    " have been working with various versions of Microsoft SQL Server since 1999"

    Man... talk about Microsoft winning the marketing war even when the tech is 3rd rate.

    Also also question the need for a book on leaning sql that is specific to that bastard version of Sybase that Microsoft sells (the real answer is that PHBs typically sign off on book buys). Sql is sql, stuff that you have to code specific to any particuloar RDBMS is not sql, or at least not standard sql. Why not teach people standard sql before giving them the nonstandard exceptions for "Microsoft SQL Server" or Oracle for that matter? Or just title the book "How to write queries for MS SQL Server 2005"?

    The answer probably is that you can't fill a book with "Learning SQL", there just isn't that much to it.

    --
    -- your Web browser is Ronald Reagan
  7. First in a series by DysenteryInTheRanks · · Score: 5, Funny
    Also coming soon from O'Reilly:

    • Learning HTML from Microsoft Word,
    • Learning CSS from IE
    • Learning Anger Management from Steve Ballmer
    • Fact Checking 101 from the Operators of Slashdot.org
    • Data Integrity for Dummies With MySQL 1.0
    • XBox Manager on How to Make a Profi ...
    ... aghhhhh, forget it, the sport has gone completely out of it ... wake me up when these completely counterintuitive books/articles stop appearing ...

    (lapses into never-ending coma)

  8. Re:Learning SQL on MS SQL is like... by vmcto · · Score: 2, Insightful

    I couldn't possibly disagree more...

    I'm no MSFT fanboy, but SQL Server (I don't count 4.2 which was basically a direct port) makes it very easy to focus on learning basic DB design, query development, and even a little performance tuning.

    With few "knobs to turn and buttons to push", the beginning DBA wannabe can do stuff without needing to know a lot of gory details.

    I am by no means advocating that top-notch DBAs don't need to eventually know all the gory details, along with a bunch of theory, just that for someone new trying to understand DBs better the tool makes it fairly easy to do so.

    I knock MSFT all day long for lots of reasons, but SQL Server ain't one of them...

  9. SQL server 2005 tools much improved by hguorbray · · Score: 3, Interesting

    While still behind Oracle in many other ways, SQL server 2005 does boast a nicely remade user tools in Management Studio.

    I took MS-SQL classes back to back earlier this year with the first one using SQL server 2003 and the 2nd one using 2005 express and the difference was night and day in ease of use.

    In 2003 you had to have 2 or 3 different applications up in order to create a table, populate it with data and then view the table data. I was constantly trying to do things in the window which didn't allow that action....Plus transact SQL was like an (even more) retarded version of SQL+

    With Management Express it can all be done from the main window -I just wonder why it took them 10 years to figure this out.

    there are still some funky aspects of MS-SQL language itself (the GO directive for instance), but this is a great new tool.

    Of course now that TOAD works on MS-SQL this may not matter much to database diehards, but I do see signs of Microsoft improving GUIs, simplifying designs and improving usability both here and in VisualStudio.

    Too bad they won't be able to do the same for Vista.....

    What's the speed of dark?

    1. Re:SQL server 2005 tools much improved by spec8472 · · Score: 2, Informative

      First of all - there was no SQL Server 2003.
      Perhaps you're talking about Visual Studio.NET 2003?

      "In 2003 you had to have 2 or 3 different applications up in order to create a table, populate it with data and then view the table data."

      With the MS SQL Server Enterprise Manager (comes with MS SQL Server 2000 - it's part of the client tools on the install CD), you can perform almost any action on the server - from creating databases, tables, views, users, through to all the scheduling, full-text index setup, etc etc.

      If you need to perform particularly complex tasks (executing a pre-prepared, or complex query) that can't be done in the GUI - the Query Analyser is two clicks away from the main Enterprise Manager window (Tools -> Query Analyser)

      "Plus transact SQL was like an (even more) retarded version of SQL+"

      That's pretty much a matter of opinion - I find T-SQL very easy to use and learn. Help and reference material is one F1 key away, and if that doesn't do it - Googling on MSDN is usually the best source of examples and references.

      My experiences with using PL/SQL under Oracle have been less than ideal - on several occasions I've had to stop using Oracle and switch to an MS SQL / MySQL environment, simply because I was spending far too much time trying to get the DB up and running. I suppose if I had several months and a good reference on hand -- that might all be different, but there's not an easy learning curve in PL/SQL (even for someone who has a decent amount of experience with other DBMSs). YMMV.

      "Of course now that TOAD works on MS-SQL this may not matter much to database diehards,"
      I suppose if you're getting paid at the Oracle consultant level, then the licence cost for TOAD isn't going to be of any matter to you. For those of us who are either freelancing - or working for a company that isn't keen on buying more expensive bits of software, then this isn't going to help.

      The biggest advantage for SQL Server is that they ship Enterprise Manager in the box.
      It makes help and maintaining a db (to a point) fairly painless, and helps to flatten the learning curve.

    2. Re:SQL server 2005 tools much improved by dcam · · Score: 3, Insightful

      I took MS-SQL classes back to back earlier this year with the first one using SQL server 2003...

      There is no SQL Server 2003. There is SQL Server 2000.

      In 2003 you had to have 2 or 3 different applications up in order to create a table, populate it with data and then view the table data.

      Learn SQL and use Query Analyzer (QA). Seriously, most SQL Server admin and management should be done in QA.

      I was constantly trying to do things in the window which didn't allow that action....Plus transact SQL was like an (even more) retarded version of SQL+

      s/retarded/standards compliant/

      --
      meh
  10. Re:Learning SQL on MS SQL is like... by cruachan · · Score: 2, Interesting

    Parent has been modded insightful? Why?

    We all like to knock Microsoft periodically for it's well know shortcomings, but SQL Server is not one of them. In fact it's one of the best products Microsoft produce. I've worked with Oracle, DB2, SQL Server, MySQL, Postgres on various products over the past decade or two, often as DBA, and SQL Server is a gem.

    It's a highly complient database and the SQL conforms to every standard going. In fact of all the databases I've worked on it's possibly my favourite as it can be installed on clients servers and left to it's own devices and it will continue to chug away with minimal human maintenance. Put that in your pipe and smoke it Oracle (or Postgres :-)

    I'm not a MS fanboy by any means, but SQL Server is an excellent product and to declaim otherwise just shows up your lack of experience. My guess is you've probably confusing MySQL with a RDBMS and extrapolating from there :-)

  11. not a review by glwtta · · Score: 2, Funny

    Reviews provide information about the content of the book beyond the sequence of chapters. The above is called a Table of Contents.

    --
    sic transit gloria mundi