Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Book Reviews Books Media

MySQL Pocket Reference 72

Michael J. Ross writes "MySQL database administrators and developers have several options for MySQL reference sources, though naturally none of them are ideal in all situations. The online MySQL documentation is extensive, but the most commonly needed nuggets are buried in its necessarily exhaustive contents. Third-party MySQL reference books can winnow out some of the rarely-used minutia, but they still encompass hundreds of pages, reflecting the complexity of the subject. For quickly looking up the most frequently used command syntax and other details, a MySQL user would usually be best served by a much more compact book, such as MySQL Pocket Reference." Read below for the rest of Michael's review.
MySQL Pocket Reference
author George Reese
pages 96
publisher O'Reilly
rating 9
reviewer Michael J. Ross
ISBN 059600446X
summary Great for quickly looking up the most frequently used command syntax and other details of MySQL


Written by George Reese, this book was published by O'Reilly Media, in February 2003. It may span only 96 pages, and weigh only 3.2 ounces, but it packs a substantial amount of useful information into a diminutive form. The book's material is organized into several sections, covering MySQL installation, command-line tools, data types, SQL, operators, functions, and table types.

After presenting a quick introduction and some other housekeeping topics, the author briefly explains how to install, configure, and start up MySQL, as well as how to set the root password. This RDBMS includes a dozen command-line tools, and the author next provides the briefest of summaries for each one, and more details on the most commonly used one, mysql.

The next four sections compose the meat of the book, as they cover the MySQL data types, SQL query language, operators, and functions. Of all the aspects of any programming language or RDBMS, the one that frequently causes the most confusion — and for which a handy reference guide would be most appreciated — is the proper use of data types. In MySQL Pocket Reference, the author presents all of the MySQL data types, grouped into numerics, strings, dates, and complex types. For each data type, the author shows the declaration syntax, the storage space required, and the purpose of the data type.

MySQL version 4.0 supports ANSI SQL 92, as well as some proprietary extensions, which is true for most if not all substantial RDBMSs. Reese explains the case sensitivity of MySQL for various contexts; the use of literals, including escape sequences; the rules concerning identifier naming and aliasing; and how to insert comments in your code. Much more space is devoted to all of the MySQL commands, ranging from ALTER TABLE to USE. For each command, the reader is shown the syntax, including optional keywords, clauses, and other elements, as well as a generous number of illustrative examples.

The last three sections of the book cover operators (arithmetic, comparison, and logical), functions (aggregate and otherwise), and table types. The section on functions will likely get a lot of use from the average reader, as it is relatively easy to forget the name and parameter list of any function — particularly if it has not been used by the developer for some time, and is not present in the surrounding code.

Like any pocket reference book, this one is not intended to serve as a full reference source or as a MySQL tutorial — of which O'Reilly offers several. Rather, it is best used for quickly answering questions concerning command syntax, operator precedence, function parameter order, or any of the other MySQL language details that are not listed automatically by programming editors, nor otherwise immediately obvious. Yet despite its small size, this book contains information that may be unknown to even some of the most experienced MySQL administrators and programmers. For instance, I had no idea that 2007-04-00 is considered a valid date. (I only wish that my taxes were due on that day.)

O'Reilly Media has a Web page on their site that provides some additional resources related to this book. These include links for reading the reviews offered by other readers, submitting your own review, and checking the errata for the book, of which there are 20, as of this writing — 19 of which have been confirmed.

There appear to be only two flaws in this book. It lacks a list of MySQL reserved words, which is odd for a reference book. Also, the text on every page is set too close to the binding, thus compelling the reader to force open the book more than should be necessary, just to comfortably read the inmost ends of the lines of text. This could be easily fixed in a subsequent edition, by moving the text outwards approximately half a centimeter, since the outer margins are much wider than necessary.

Speaking of editions, because this first edition of the book appeared in early 2003, it covers up to version 4.0 of MySQL. One can only hope that a second edition will be made available at some point in the future, so that it can be brought up to date with all of the new additions to MySQL 5, which are substantial. These include cursors, stored procedures, triggers, and views.

Nonetheless, this first edition would be of value to anyone using MySQL. In essence, MySQL Pocket Reference is neatly organized, extremely portable, and packs much valuable information into a succinct format.

Michael J. Ross is a Web programmer, freelance writer, and the editor of PristinePlanet.com's free newsletter. He can be reached at www.ross.ws, hosted by SiteGround."


You can purchase MySQL Pocket Reference from amazon.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.

MySQL Pocket Reference

Comments Filter:
  • Nope. (Score:5, Informative)

    by tomhudson ( 43916 ) <barbara@hudson.barbara-hudson@com> on Monday April 09, 2007 @02:45PM (#18667121) Journal

    For quickly looking up the most frequently used command syntax and other details, a MySQL user would usually be best served by a much more compact book

    For quickly looking up the most frequently used command syntax and other details, a MySQL user would usually be best served by a quick trip to google.

    • Comment removed (Score:5, Insightful)

      by account_deleted ( 4530225 ) on Monday April 09, 2007 @02:47PM (#18667145)
      Comment removed based on user account deletion
      • Unless you work for a company that doesn't allow external web-browsing during hours... In which case I recommend ANYTHING by O'Reilly.

        Not this - it only goes up to MySQL 4.0. Is *anyone* still using that? Even 4.1 was a big improvement. "on duplicate key update" is a huge time-saver, both in coding and in run-time, when you have a large insert query with many potential dupes. 4.0? Sorry, "on duplicate key" isn't available.

        • Re: (Score:1, Funny)

          by Anonymous Coward
          Learn how to use a real database [microsoft.com]. MySQL losers...
        • According to their docs, 4.1 is officially End of Life, so you'd hope the answer to your question is no. Unfortunately, I worked on a project about a year ago that was required to run on 3.23.
        • by isorox ( 205688 )
          Not this - it only goes up to MySQL 4.0. Is *anyone* still using that?

          We still use 3.23 for broadcast data, because it works, and always has done. It has a ~2 year uptime since the last safety test, and it's a fairly light database (500,000 queries per day).

          New development projects go on to 5.1 and use it's features where appropiate

          One database we have, from an external company, has just moved to 4.1 under pressure from us, although the code that accesses it hasn't been changed. The change was to allow eai
      • How does anybody work in an environment such as this? I find tons of shortcuts for things I do at work on the internet. Stuff that would never be written down in any textbook. How does working without internet access affect your productivity?
      • Resume (Score:5, Insightful)

        by Slashdot Parent ( 995749 ) on Monday April 09, 2007 @03:02PM (#18667311)

        Unless you work for a company that doesn't allow external web-browsing during hours... In which case I recommend ANYTHING by O'Reilly.
        That may be your recommendation. My recommendation would be to polish up your resume.

      • Re: (Score:3, Insightful)

        Unless you work for a company that doesn't allow external web-browsing during hours...

        I can't imagine myself working in an environment where I can't access online resources while I'm working. The productivity gain is very significant. Any company that doesn't realize this is clearly managed by idiots.
      • Geeeze dude. I really feel sorry for you. Get another job real quick man.
    • Re: (Score:3, Funny)

      by Itninja ( 937614 )
      Totally. How could this book be any 'quicker' that a Google search. Maybe the book using indexing like
      "What's that one query command I used that one time?...... page 156"
      • I guess you could email each section of the book to your gmail account, one section or topic per email, and have google search it for you ... :-)

        I like O'Reilly books - I've got a bunch of them on my shelf - but a pocket reference that only goes up to 4.0 is worse than useless, considering the big changes in 4.1, and especially in 5x.

    • by RedElf ( 249078 )
      Hey now be nice some toys need instruction manuals to operate. MySQL just happens to fit in that category.
  • MySQL Web Page [mysql.com]

    Seriously, have you ever found yourself away from an Internet connection lately? I actually have a couple pocket references from years ago, but once the PHP manual and its user submitted comments hit the web, all manuals have adopted this technique, and we are all better off. Pocket references are soooooo 2002.

    • PHP's user annotated reference manual is probably the best thing since the invention of the computer manual itself. How many times have you read the documentation only to still be completely lost as to how something actually works. Having real users put in comments means that after the first person figures out some neat trick, the rest of us don't have to.
      • PHP's user annotated reference manual is probably the best thing since the invention of the computer manual itself. ...


        You can post comments to the MySQL Manual(s) as well.
        • I actually mis-read

          but the most commonly needed nuggets are buried in its necessarily exhaustive contents
          as

          but the most commonly needed nuggets are buried in its necessarily exhaustive comments
          because it's the comments section of the MySQL online manual where the real explanations of functions can be found.

          It's a shame somebody can't gather together the most essential comments and publish those in a book.
    • Seriously, have you ever found yourself away from an Internet connection lately?
      Yes. I have this pesky social life thing. However...

      Seriously, have you ever found yourself away from an Internet connection while writing SQL queries lately?
      No, I work at a company that understands that to write internet based applications you generally need access to the internet. And I am grateful.
    • by EvanED ( 569694 )
      Seriously, have you ever found yourself away from an Internet connection lately?

      Yes, during 22 hours of transit, then 3 1/2 hours of transit, then 3 1/2 hours of transit, then 4 hours of transit, then 9 hours of transit. And that's just in the last 8 days.

      (Okay, so during at least a fair portion of that time I could have accessed, for instance, airport Wi-Fi. But a good part of that, without a cell phone with internet access, I would have got nothing.)
      • Nice battery you got there! Mine lasts about 2 hours...

        Your point is valid.

        • by EvanED ( 569694 )
          During the 3 1/2 and 4 hour things, that was in the car (I wasn't driving), and I had a power inverter I could have plugged into the cigarette lighter. The longer trips had layovers in places with power outlets.

          Now, I wasn't actually using my computer most of that time (in particular, during large portions of these I was trying to sleep), but I did some of it, and I was coding, and there were times when I wished that I had internet access or had installed the MSDN library.
  • by Bluesman ( 104513 ) on Monday April 09, 2007 @03:20PM (#18667517) Homepage
    1) Buy business card stock
    2) Print out cards that say "http://www.postgresql.org"
    3) ...
    4) Profit!

    • I would love to switch over to Postresql, but my hosting service doesn't support it. Also, my PHP code is littered with functions starting with mysqli_. Is there a good PHP database abstraction layer? Why are we still at a point when we're writing code against a particular database? I shouldn't have to write my own DB abstraction layer either.
      • Re: (Score:3, Insightful)

        Why are we still at a point when we're writing code against a particular database?

        Because all databases are their quirks and various different ways of doing a bunch of little things. Writing fully DB-agnostic code is an utopia. Just like there's no "perfect" framework out there to write cross-platform desktop applications that look and feel right on any given platform.
        • Maybe the SQL itself isn't going to be database agnostic, but you should be able to run the query and get a result set back without having to call a function specific to the database. .Net has a pretty good abstraction layer, such that I don't have to worry about which database I'm connecting to, and I can connect to Access, SQL Server, Oracle, MySQL, Excel files, and others without calling functions specific to the database. There will always be little quirks, but I shouldn't have to call different functi
          • by Shados ( 741919 )
            So true. The ONLY thing that irked me so far about .NET's layer is the method that allows you to figure out the parameters of a stored procedure. Its in OleDb_, Sql_, and Oracle_ providers, but not in Db_, so you either have to use a provider specific method, or have fun with Reflection. It should be implemented at the abstract class level, with maybe a property "SupportDeriveParams" or some such or throw an exception if its not implemented, I don't know. But having to use SqlCommandBuilder.DeriveParameters
        • Re: (Score:3, Informative)

          by Shados ( 741919 )
          Using database abstraction layers and object relational mappers like Hibernate or LLBLGenPro allows for the most part to be DB-agnostic except for the most ressource intensive queries where you need to use DB-specific optimisation, which is rather rare except with reports and such, and even then, 90% of the queries that hit the server pretty hard would be better done on an OLAP system of some kind, so the above are pretty darn good.

          Then again, these tools have disadvantages of their own, but still.
      • Re: (Score:3, Funny)

        by tomhudson ( 43916 )
        Use the c preprocessor to create your php files. 1. Create a source file "something.php.c" #define DB_SERVER example.com #define DB_USR example_user #define DB_PW example_password #define DB_CONNECT $link = mysql_connect("DB_SERVER", "DB_USR", "DB_PW") DB_CONNECT; 2. g++ -o something.php something.php.tmp 3. grep -v "#" something.php.tmp > something.php This is just an example to get you started, but now you can include all sorts of files at coding time, instead of at run time. So put the #define
      • by xannik ( 534808 )
        Check out the PEAR project's solution. http://pear.php.net/package/MDB2 [php.net]. The code at PEAR is normally high caliber and will make your own PHP code much more robust.
      • Is there a good PHP database abstraction layer?

        As of PHP 5, I use PDO (a standard PHP 5 feature). Prior to that, I used Pear::DB which is often available on shared hosting services.

      • Re: (Score:3, Interesting)

        by Doug Neal ( 195160 )
        Take a look at this - http://sqlrelay.sourceforge.net/ [sourceforge.net]

        It claims to be able to proxy and load balance database connections, supports different database backends and implements the PHP APIs for MySQL and PostgreSQL itself, so you can use it as a drop in replacement. In theory it should be possible to use it to talk to PostgreSQL using the MySQL API. I was planning to check it out with a view to moving some MySQL/PHP sites over to Postgres, but never did (and don't work at that place any more), so I can't vouc
      • by Tychon ( 771855 )
        Maybe I'm just oblivious, but isn't that what PDO [php.net] is included for?
        • That seems to be what I'm looking for, but why haven't I found it before? Nowhere in any tutorials do I see mention of this. Why do things like mysql_ even exist in the first place? The more I use PHP, the more I start to Love .Net, and Java with their wonderfully organized APIs. The again, most PHP tutorials I've found don't even use prepared queries, leaving open tons of sql injection attacks, so I don't find it completely surprising that most people recommend using a Database API that's tied to the d
    • by irc.goatse.cx troll ( 593289 ) on Monday April 09, 2007 @03:38PM (#18667695) Journal
      or better yet, get a usb thumbdrive and stick SQLite [sqlite.org] on it so you can ship your product without relying on them having a DBA to set it up on the other side. I still don't see why so many people use MySQL or PGSQL for simple webapps like blogs and CMS systems. You arn't going to have multiple accesses from seperate machines, simultaneous updates, or any other possibly reason for justifying a remote DB. The only reason MySQL is so popular is it was shipped default in so many distros. Switching to PGSQL is just using a different brand of the wrong tool (90% of the time, of course)

      How long does it take you to move your webapp+db to a clean machine? I can just rsync.
      • by Rakishi ( 759894 )

        How long does it take you to move your webapp+db to a clean machine? I can just rsync.
        How often do you move your small web blog across machines? I can technically rsync a MySQL database (MyISAM at least) as well and it will work fine on the other end.

        You arn't going to have multiple accesses from seperate machines, simultaneous updates, or any other possibly reason for justifying a remote DB.
        Unless slashdot links you for example.
  • winnow [win-oh]
    -verb (used with object)
    1. to free (grain) from the lighter particles of chaff, dirt, etc., esp. by throwing it into the air and allowing the wind or a forced current of air to blow away impurities.
    2. to drive or blow (chaff, dirt, etc.) away by fanning.
    3. to blow upon; fan.
    4. to subject to some process of separating or distinguishing; analyze critically; sift: to winnow a mass of statements.
    5. to separate or distinguish (valuable from worthless parts) (sometimes fol. by o
  • by smack.addict ( 116174 ) on Monday April 09, 2007 @04:29PM (#18668153)
    #1 I was actually kinda shocked to see a /. review on this, as the book came out in 2003.

    #2 Good news is, I finished up the next edition over the weekend and it should be out (I think) in the early summer. This new edition covers through MySQL 5.1.

    #3 If you don't use stored procs or triggers, for the most part, the things you would need in a pocket reference are still all in the old edition and quite valid. Yeah, I also added more useful information on replication and updated all the SQL syntax, but that is stuff 90% of the population does not necessarily need.
  • by FuryG3 ( 113706 ) on Monday April 09, 2007 @04:33PM (#18668203)
    The correct spelling of the word:

    Privilig..errr

    Privelig..errr

    Privileges!

    Preferably on the cover of the book.
  • by suv4x4 ( 956391 ) on Monday April 09, 2007 @04:47PM (#18668385)
    How on earth, in year 2007, is a book the quickest reference to anything. MySQL provides both instant manual lookup online, and indexed searchable CHM help manual reference.
    • Re: (Score:2, Insightful)

      by kpharmer ( 452893 )
      > How on earth, in year 2007, is a book the quickest reference to anything. MySQL provides both instant manual
      > lookup online, and indexed searchable CHM help manual reference.

      1. it is small enough to be always handy (keep it in your laptop bag, next to your puter, etc)

      2. since all it has are concise explanations - you'll spend less time wallowing in stuff you don't care about (when you want is something concise)

      3. it is formatted specifically for quick syntax & example checks, rather than for
      • by suv4x4 ( 956391 )
        I guess we have some people from the last century visiting us...

        -----------
        1. it is small enough to be always handy (keep it in your laptop bag, next to your puter, etc)

        I have to agree. I saw some experimental graphical interfaces on TV yesterday, and it looks really promising, Not only you get to work visually, but you get to lay out your screen space as you want (for example, place shortcuts to needed references on your "task bar" they call it). And the best thing is: you can run multiple apps at once! Bu
  • Visibone has just released a newer MySQL cheatsheet [visibone.com]. I use the Visibone Browser Book [visibone.com] a lot. Very convenient.
  • Of course, I have had the MySQL Manuals in "pocket" (Palm, mobile) format for quite some time... you can get them over here [plkr.org] in Plucker [plkr.org] format.

    I also have the PostgreSQL documentation in Plucker format [plkr.org] as well.

    (Don't forget to check the rest of my mobile work [plkr.org] if you're interested in some of the other custom conversions I've done: FreeBSD docs [plkr.org], PHP docs [plkr.org], Cygwin/CygwinX FAQ [plkr.org], and dozens of others).

  • MySQL "POCKET" Reference... I'm not sure 96 pages will fit in my pocket very easily.

  • I own this. My biggest problem is that, as a relative beginner, I don't always know which command I want. Here is the relevant part of the table of contents.

    ...
    Commands 30
    Rules of Precedence 67
    ...
    That's it. Thirty-six pages of commands, almost half the book, without a list of what those commands are, and no index. For me, this book is pretty much useless. I almost always end up going to the online documentation.

C'est magnifique, mais ce n'est pas l'Informatique. -- Bosquet [on seeing the IBM 4341]

Working...