Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Books Media Databases Software Data Storage Programming Book Reviews IT Technology

The Definitive Guide to MySQL, 2nd Ed. 128

Craig Maloney writes "I'm skeptical whenever a publisher uses the words 'Definitive,' or 'Complete,' or (especially) 'Ultimate' in the title of a computer book. Sadly, the typical book so labeled is a jumble of incomplete ideas crammed together with very little depth. Worse, some books do little more than re-print the various command-line switches for the application. Michael Kofler's The Definitive Guide to MySQL (2nd ed.) is just the opposite. There're still lots of ideas crammed inside of the book, but they're carefully explained and expanded. The book weighs in at a hefty 802 pages, with very little fluff. " Read on for the rest of Maloney's review.
The Definitive Guide to MySQL
author Michael Kofler
pages 802
publisher Apress
rating 10/10
reviewer Craig Maloney
ISBN 1590591445
summary A useful and complete reference to using and programming with MySQL

The book has four sections: Introduction, Fundamentals, Programming and Reference. The Introduction begins with a brief introduction to databases, relational databases, ANSI 92, and how MySQL fits in to each of these. It also touches on the licensing for MySQL (commercial vs. non-commercial usage) and a version roadmap for past and future releases of MySQL. The roadmap is very helpful to know what features are present in the version of MySQL you may be using (or are planned for an upcoming release).

Next, Kofler sets up a rudimentary testing environment which is used through the rest of the book. He does an excellent job of outlining a decent development environment under both Unix and Linux without getting too bogged down in trying to describe every single user interface for accessing MySQL (those are described later in the book). It steps through setting up MySQL, Apache, Perl (with DBD and DBI), and PHP, and also adds phpMyAdmin as a graphical tool to administer the databases. The unit ends with a simple PHP script to handle an opinion poll. This all happens in the first 80 pages of the book.

Fundamentals

The next section expands on the basics learned in the first chapter. First is a chapter on the user interfaces available for using MySQL, starting with the MySQL command-line client, followed by an introduction to several graphical clients (including phpMyAdmin and MySQLCC). Database design is covered in the next chapter, starting with a brief overview of the theory in designing a relational database. First, second and third normal forms are introduced with examples, as are relations (1:1, 1-n, and n-n), data types, and indexes. Once the reader is armed with the theory, the book continues with how to create the tables in SQL, and covers using SQL to examine and manipulate data in "Introduction to SQL." "SQL Recipes" contains lots of useful scripts for handling interesting cases of SQL (like selecting data at random, pivot tables, creating a new table by copying, etc). A special section is devoted to the new InnoDB format, which brings transactions and integrity rules (foreign key constraints) to MySQL. "Security and Administration" complete the Fundamentals unit with topics on user-level security, backing up the data, and replication between two MySQL instances.

Programming

Unlike most books, the programming languages introduced in The Definitive Guide to MySQL aren't introduced with examples as though you have never programmed a computer before. (So beware, if you haven't; this is probably not the right book for you.) The examples start with useful code that assumes familiarity with the language. The examples are excellent, demonstrating how to efficiently get your code connecting to the database. The author covers PHP, Perl, Java, C and C++, and Visual Basic, C# and ODBC. PHP is the real star of the book, though, garnering a second chapter to expand on the earlier examples presented in the book, but the other languages (and ODBC) are given excellent treatment. Fans of these languages will be able to get their programs running with MySQL using the examples from the book.

Reference

The last 100 pages (not including the appendix, glossary and index) contain several references for MySQL. "The SQL Reference" covers the SQL commands that MySQL understands (along with what versions they are valid for), as well as system and session variables and data types. Coverage of the utilities that MySQL uses is in the "MySQL Tools" section. Lastly, the API reference rounds off the book with the functions and variables for each language in an easy-to-use reference. Whew!

Programmers will find excellent examples for linking their programs with MySQL, and developers will find the reference and examples extremely useful for taking their data from creation to deployment. I found this book easy to read and exceptionally useful. The author did the hard work of taking the documentation and sifting through it to bring the useful parts together clearly and concisely. Definitive indeed.


You can purchase The Definitive Guide to MySQL from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

This discussion has been archived. No new comments can be posted.

The Definitive Guide to MySQL, 2nd Ed.

Comments Filter:
  • Interesting book but (Score:3, Interesting)

    by 2.7182 ( 819680 ) on Monday November 22, 2004 @05:02PM (#10892212)
    the binding on my copy broke after a month. Anybody else have this trouble ?
    • "Also, a bunch of the pages were sorta stuck together."

      I know we slashdot readers are geeks but this is a technical book, not a Playboy !
    • The pages won't stick together if you lay off the porn when you have the book open.
    • by DevNova ( 24921 ) <info2@ne[ ]rk23.com ['two' in gap]> on Monday November 22, 2004 @05:38PM (#10892599) Journal
      There is a technique to use with new books that will almost completely eliminate books breaking at the binding. I learned this in a speed reading course over ten years ago and in that time, I have never had a book binding break on me.

      First, hold the book so the binding is resting on a hard flat surface (let's say a table), as if you are about to open it. Fold back the front and back covers so they are flush with the table.
      (end view, ignore dots)
      .....|||
      .....|||
      _____|||_____
      Run your thumb up and down the crease where the covers meet the binding, helping them to lie flat.
      Now take 8-15 pages from the front of the book and 8-15 from the back of the book and lie them flat, again running your thumb along the binding to help flatten them out. Continue this process inwards, continually flattening the pages out until you come to the middle of the book an do a final "press" down the middle.
      • 802 / 25 (say 12,5 pages per fold) ~ 32 folds, if you were wondering. Reading the book will be more work though.
      • There is a technique to use with new books that will almost completely eliminate books breaking at the binding...

        Can't somebody invent a machine that does this at the printing factory? Or dare I say.......offshore it.

        Anyhow, thanks for the tip.
      • wow, haven't seen that in a while. we were taught to do this in grade school with new textbooks. it made them easier to read flat when you were working at your desk.
      • by Anonymous Coward
        Then do the exact same thing with your girlfriend and she'll be yours forever!
    • Sounds like such a book would be a perfect match for MySQL.
  • I wonder... (Score:4, Funny)

    by rackhamh ( 217889 ) on Monday November 22, 2004 @05:04PM (#10892249)
    ... how does a "definitive" book get to have a 2nd edition? Wasn't the 1st edition definitive? :P
  • by Russ Nelson ( 33911 ) <slashdot@russnelson.com> on Monday November 22, 2004 @05:06PM (#10892269) Homepage
    This is the Definitive Complete Ultimate comment on this story. Moderators: you can now mark all other comments Redundant.
    -russ
  • Examples (Score:3, Interesting)

    by cuteseal ( 794590 ) on Monday November 22, 2004 @05:13PM (#10892335) Homepage
    "PHP, Perl, Java, C and C++, and Visual Basic, C# and ODBC" Does the author show each and every example in all these languages? If he did, no wonder the book's 800+ pages long!
  • My guess (Score:4, Interesting)

    by FullMetalAlchemist ( 811118 ) on Monday November 22, 2004 @05:13PM (#10892344)
    My guess is that MySQL will decline now that PHP uses SQLite, and that PostgreSQL has so much more speed, stamina, strength and beauty.

    Still, it's good that comprehensive book is released, some will sure find it useful.

    Now, someone point me to a nice book on SQLite integration with .NET remoting and I'll be really happy.
    • > now that PHP uses SQLite

      FWIW, there's also a nice SQLite binding for Ruby [rubyforge.org]:
      require 'sqlite'
      db = SQLite::Database.new( "test.db" )
      rows = db.execute( "select * from test" )
      Good stuff!
    • Re:My guess (Score:3, Interesting)

      by tcopeland ( 32225 ) *
      > PostgreSQL has so much more speed,
      > stamina, strength and beauty.

      The PostgreSQL [postgresql.org] database on RubyForge [rubyforge.org] has been slowly growing over the past year or so... it's up over 825K records and ticking along smoothly. I can't see ever going back to MySQL unless forced to...
    • Re:My guess (Score:2, Interesting)

      by scribblej ( 195445 )
      Does anyone today look at the available technologies, and actually choose MySQL over PostgreSQL? I mean, assuming they aren't already using any database, and they don't have any requirements that would force them to MySQL (like a PHB saying, "But I've HEARD of MySQL! What's this Postgres crap?")... why would anyone choose MySQL?

      • I don't think they have yet published an Idiots Guide to PostgreSQL. Thus no idiots, lets just keep it to ourselves OK?
      • Re:My guess (Score:4, Informative)

        by Phillup ( 317168 ) on Monday November 22, 2004 @05:40PM (#10892614)
        I guess it depends on what you call "available technologies".

        If you look at web hosting, you almost always see MySQL as "available" while PostgresSQL is a bit more rare.

        That is, IMHO, why PHP is so popular... and the same goes for MySQL.

        They are ubiquitous.
        • Interesting. Is there any theory on why mysql is popular to web hosts?
          • Boring (Score:2, Informative)

            by DogDude ( 805747 )
            Interesting. Is there any theory on why mysql is popular to web hosts?

            Simple. Plain old web server admins rarely know anything about databases. Anybody who knows how "real" databases work is gainfully employed at a lucrative job, not rebooting Linux boxes that host "About Me" web pages. Out of the whole dot-bomb debacle, the only people I know that are still employed (and still paid very well) are Oracle DBA's. They couldn't give two shits about dinky web servers when they're massaging terabytes of
      • Results 1 - 10 of about 22,600 for "shared hosting" postgresql. Results 1 - 10 of about 638,000 for "shared hosting" mysql. (0.35 seconds) You use what you have, especially people just getting started with a $9.99/month host.
      • Re:My guess (Score:3, Insightful)

        by runderwo ( 609077 ) *
        1. MySQL has a solid Win32 port.

        2. MySQL has an entire community dedicated to helping people with the problems caused by its defects.

      • Answer (Score:3, Insightful)

        by base_chakra ( 230686 ) *
        Does anyone today look at the available technologies, and actually choose MySQL over PostgreSQL? I mean, assuming they aren't already using any database, and they don't have any requirements that would force them to MySQL (like a PHB saying, "But I've HEARD of MySQL! What's this Postgres crap?")... why would anyone choose MySQL?

        This has come up more than once in previous discussions. Reasons include: web hosts not supporting PostgreSQL, technology unfamiliarity with ORDBMS's relative scarcity of graphica
      • For my own part I started using MySQL to satisfy my database needs because I read an article about it in some Linux magazine. At the time I did not hear of any alternatives (such as PostgreSQL), nor did I care much. MySQL, at the time, was all I needed to store my DVD database. It may not have sub-stored procedural selects and three dimensional locking over-views but it did (and still does) all I need.

        Will I change to PostgreSQL? I don't know. I am sure there are good reasons to do so, and good reasons no

      • Re:My guess (Score:3, Interesting)

        There are other reasons besides superior technology for choosing MySQL over Postgresql. For one, I program in Perl and use the very excellent Active state debugger on a Windows XP box. There is no DBI module for Postgresql under Windows so I can't walk through my code if I choose PGSQL. I also use a Windows box because my editor (PFE32) can be set up for my keyboard while Linux(any version) cannot. Until Linux decides to support keyboards with function keys, arrow keys, pgup, pgdn,home,end, etc. and ma
      • Re:My guess (Score:5, Insightful)

        by ngunton ( 460215 ) on Monday November 22, 2004 @06:48PM (#10893292) Homepage
        In my experience, MySQL works very well. I am fully aware of all the "gotchas" out there, and the reasons why MySQL is such a toy, shouldn't be used for anything ever, etc, but to be honest there are a couple of things putting me off trying PostgreSQL:

        First, I honestly am repelled by the fanboys who immediately pop up like clockwork whenever MySQL is mentioned and say that it is a piece of crap, and PostgreSQL rocks. MySQL is not crap. Perhaps PostgreSQL does rock, but all the obnoxious "advocates" for PostgreSQL just remind me of so many religious fanatics. It's at the point where I don't even care if they have a point or not, it's just too shrill and monotonous. Whenever MySQL gets mentioned, I can GUARANTEE that someone will pop up screaming about how crap it is and why isn't everyone using PostgreSQL instead. I have been using MySQL for about four years now, and so I know from personal experience how well it works. There are probably some things that PostgreSQL does better, perhaps many things, I don't know. I just know that there are many things that MySQL does perfectly adequately or even extremely well, for me, and no amount of "sorry but you're simply wrong" can dissuade me from this opinion, since I am speaking from personal experience over a period of years. Also, there are many companies using MySQL in a major way, if it was so crap then why/how would this be. Never mind, I suppose all those companies are just totally clueless. I suppose now people will also put me down for not being a "real" DBA or something. Whatever.

        Secondly, MySQL is simple. When I first tried using it, the thing "just worked". Everything is there in the package. Whenever I tried looking at PostgreSQL (not recently, see above) it always seemed much more complicated and not as friendly. Well, I have something that has been working very, very well for me for a long while now, so why put myself through all that hassle? Whether it actually is or not, PostgreSQL *seemed* harder and more complicated. The documentation seemed more geared toward people who are willing to really dig into this stuff in a big way and learn all the wrinkles for tuning your database. Whenever someone criticizes PostgreSQL for this, someone seems to reply that a database *shouldn't* be used by someone "out of the box", without thinking much about all the tuning and suchlike. This is a very elitist viewpoint, imho, there are many people out there who simply want a database that "just works". It's worth noting a simple truth, that Simplicity Rules. It doesn't matter how technically brillian your tool is, if it appears to be complex then people will probably use the simpler competitor instead, even if it isn't as technically brilliant as your baby.

        So, here's my point: If the PostgreSQL crowd could be a little bit less aggressive in their hostility toward MySQL, and focus instead on making the toolkit as easy to use and accessible as MySQL, then perhaps they would win over more people and become more popular.

        Just my opinion.
        • Agreed. (Score:3, Insightful)

          by Aldric ( 642394 )
          MySQL is an excellent database server, as is Postgre. Maybe the fanboys should find something better to do with their time than hanging around Slashdot complaining about the database some other people use?
        • Re:My guess (Score:1, Redundant)

          by Ztream ( 584474 )
          Well, there's a reason us Postgres fanboys behave like that. MySQL gets a LOT of press and is widely recognized. Postgresql gets almost none.
          If you've used both and found Postgres to be superior, and more or less fell in love with it, you get frustrated at the lack of public awareness. This causes us to take every opportunity we can to "inform" (annoy) people about this wonderful thing that we've found. Of course, /. is probably the worst place since Postgres awareness is probably comparatively high around
          • Yes, exactly. I must admit I am somewhat of a fanboy. I don't "pop up" like the grandparent post described, but I do come to these MySQL stories specifically looking for PostgreSQL comments. And sometimes I post, like now. But I don't go looking to troll or anything, just trying to advocate a great piece of software that I think gets far too little attention.

            It's not unique to PostgreSQL. Any time people discover a great alternative to a well-known mainstream product, those people will use any forum to

        • Wow. (Score:3, Insightful)

          by boodaman ( 791877 )
          I have a doppelganger, and it is you. I was just about to type the same thing!

          Well said.

          I've been using MySQL for 5 years. It just works, it has handled load very well with default configurations, it is easy to install, and client support is very strong. For example, I admin all of my MySQL servers from a Windows desktop at work. All free, all without problems, very stable.

          We looked at PostgreSQL...for our purposes it would have been like using a sledgehammer on a tack. Does that mean we don't have any
        • I get it now. MySQL v. PostgreSQL is the open source equivalent of the closed source MSSQL v. Oracle (without the cost argument)
        • If you have time to care about databases, but you're turned off by the PostgreSQL community, just pick up a book that describes the relational model.

          On the shelf next to me I have one of the best books I've ever bought, called "An Introduction to Database Systems" by C.J. Date.

          Read some of that, and pick up some database that you haven't used before, like DB2, Oracle, Sybase, whatever. Those probably all have free trials. Try to understand the reason so many companies spent so much time and money perfecti
        • So your main argument is, that mySQL is "simple". Well, pretty weak, may I mention. Could've said harsher, but I really don't want to disdain anyone. Thing is, it is "simple" for you so you base your whole argument on mySQL being simpler.

          Whenever I tried looking at PostgreSQL (not recently, see above) it always seemed much more complicated and not as friendly. Well, I have something that has been working very, very well for me for a long while now, so why put myself through all that hassle?

          Again, you s
    • My guess is that MySQL will decline now that PHP uses SQLite, and that PostgreSQL has so much more speed, stamina, strength and beauty.

      Now where's the Intelligence and Wisdom in that?
    • My guess is that MySQL will decline now that PHP uses SQLite, and that PostgreSQL has so much more speed, stamina, strength and beauty.

      Do I remember hearing that Apple's Searchlight feature in the upcoming Mac OS X 10.4 ("Tiger") uses SQLite as well?
    • The problem with that logic is it assumes MySQL depends on PHP for it's usage. If this were true, then when SQLite was intorduced nobody would have been complaining of having to link MySQL manually when installing PHP. And of course, PHP-MySQL is not the only combination under the sun, MySQL is used with many apps.
  • some free books (Score:5, Informative)

    by bcrowell ( 177657 ) on Monday November 22, 2004 @05:21PM (#10892431) Homepage
    There are several free SQL books [theassayer.org] available (one on MySQL, one on SQL in general, and a couple on PostgreSQL; use your browser to search within the text of the page for SQL). User-submitted reviews would be welcome on theassayer.org.
  • ISBN? (Score:5, Informative)

    by glass_window ( 207262 ) on Monday November 22, 2004 @06:18PM (#10892962)
    They should be required to post the ISBN number with the review. In case you're wondering, it's 1590591445.
  • by LadyLucky ( 546115 ) on Monday November 22, 2004 @06:22PM (#10892989) Homepage
    http://sql-info.de/mysql/gotchas.html [sql-info.de]

    I'm lovin' it!

    • Actually, the MySQL team uses that (outdated) list as one source for ideas on things to work on for future versions, it's much appreciated!
      • Hey, thanks!

        Seriously though - if you find anything outdated (or just plain wrong) in the list, please tell me about it and I'll post updates. FWIW I gave it the once-over when 4.1 was certified as stable a few weeks back, but I may have missed something.

        Disclaimer: despite appearances I do actually work with MySQL databases, and I'd be more than happy to see that list get smaller.
        • The next link on this page drops you into the postgres gotchas...

          http://sql-info.de/mysql/transaction-innodb-tabl e. html
        • My accusation of outdatedness has to do with the delay in recognising fixes until a version is declared production, and has less to do with your list than with the fanboys who point to it then take pride in the native Windows Postgres build that is not in production. You may want to take a look at the TRADITIONAL mode, as seen in http://dev.mysql.com/doc/mysql/en/Server_SQL_mode . html When MySQL 5 goes production, this will knock a few items from your list, as it causes errors instead of warnings on bad
    • Note that every RDBMS has gotcha's.
      • Note that every RDBMS has gotcha's.

        Yup, but no database I've used has as many gotchas as MySQL. Recently I have been bitten by the following ones:

        • MySQL accepts invalid dates
        • MySQL doesn't support a BOOLEAN type
        • MySQL regularily corrupts tables if a JDBC connection dies during a write
        • The default table type (the one I'm stuck with thanks to company politics) doesn't support referential integrity or transactions

        MySQL was chosen by my predecessors because it was the only free database they'd heard of

  • Is it just me or is everyone over the re-hashed books on anything technology specific....

    I started off using mySQL years ago but in the past 12 months migrated everything to PostgreSQL. I picked up a book on PGSQL just to see what im missing out on and could not justify the cost. (books in Australia are very expensive: $USD70 for the average book in oz).

    I think books are great to get your started to know something like SQL but hardly worth buying every revision...or technology...

    Especially when most of t
  • Any technology that takes 800 pages to explain perhaps needs to be reworked. RDBMS seem to keep adding obscure features to lock customers in to their product. MySql seems to be following this trend either to do the same thing or out of RDBMS copycat habit.

    Rather than pull an Oracle, I would like to see a RDBMS that tries to use simple concepts, including perhaps a new simple relational language besides SQL[1]. It would get its power from custom add-ons and hooks, not by trying to be everything to everybody
    • RDBMS seem to be adding obscure features

      MySQL has taken a long time to acquire even standard SQL features, let alone obscure ones. (Version 4.1 is a huge improvement).

      I would like to see a RDBMS that tries to use simple concepts, including perhaps a new simple relational language besides SQL[1]. It would get its power from custom add-ons and hooks, not by trying to be everything to everybody out of the box.

      The concepts behind RDBMSes are simple - that is why they are so widely used. What is complex is
      • MySQL has taken a long time to acquire even standard SQL features, let alone obscure ones. (Version 4.1 is a huge improvement).

        Perhaps their priorities could be tuned in some areas.

        If you devised an SQL replacement it would soon look just as just as sophisticated.

        I disagree. SQL syntax is ugly by almost any standard there is. Its syntax "tree" is lot like COBOL in style. Compare the syntax of COBOL to say C, TCL, Lisp, etc. It is at least an order of a magnitude more complex. And, it lacks referen
        • I disagree. SQL syntax is ugly by almost any standard there is. Its syntax "tree" is lot like COBOL in style. Compare the syntax of COBOL to say C, TCL, Lisp, etc. It is at least an order of a magnitude more complex. And, it lacks reference composability (at least in the standard), which contributes to its complexity because it has to make up for it in other ways.

          I would not say that the syntax is an order of magnitude more complex, but I see what you are saying. My point is that SQL expresses a lot, and
    • Here's the full text:

      MySQL roXorZ!!!
    • Re:800 pages? (Score:1, Informative)

      by Anonymous Coward
      Google for "Tutorial D" .. that's a replacement language by C. J. Date and others based on set theory rather than..whatever SQL is based on ..

      Actually, you should read all the stuff on their site (www.dbdebunk.com) to see just what a sad state the DB industry is in right now.

      Anyway, here's a taste of how Tutorial D makes things simpler.

      In SQL if you want a set of all tuples in a relation, you type: "SELECT * FROM Relation". In a Tutorial D-like language you type just: "Relation".

      If you want to extend th
      • Google for "Tutorial D" .. that's a replacement language by C. J. Date and others based on set theory rather than..whatever SQL is based on ..

        Here is a draft of my pet relational language:

        http://www.c2.com/cgi/wiki?TopsQueryLanguage

        Tutorial D mixes infix and prefix table operators, which bothers me a bit.
  • Whenever I start a new CS topic, the first thing I do is go get the relevant O'Reilly books. They're just so easy to read and find whatever information you need. And while they may not be 'Definitive' or 'Ultimate', I think that, ultimately, they're the best way to begin.
  • I'm going to buy one or more books on MySQL and related subjects (the LAMP-stack). I usually go with the newest O'Reilly book on the subject (any subject), but the reviewed book seems interesting. 10/10 from a Slashdot review and no serious arguments from the masses, that is pretty good recommentation.

    My questions are:

    If you have read/used this book, is it really that good?
    If you have not read/used this book, what book have you read/used and found satisfactory as a desktop reference book.

    --Flam
  • Comment removed based on user account deletion
  • Instead of whining about how "mysql sux0rz, postgresql r0x0rz", you should be asking yourself why mysql is dominant over postgresql.

    If postgresql is so superior, why hasnt it been able to get any significant market share?

    Why does mysql dominate webhosting?

    Why are huge sites with hundreds or thousands of transactions/sec successfully using mysql without any problems? postgresql fanatics claim such sites simply cant exist because mysql can't handle "those kinds of loads".

    Solve those questions and maybe po

Understanding is always the understanding of a smaller problem in relation to a bigger problem. -- P.D. Ouspensky

Working...