MySQL & mSQL
Authors: Randy Jay Yarger, George Reese, and Tim King
Publisher: O'Reilly & Associates
Price: $34.95 US
Reviewer: Reuven M. Lerner
Relational databases are based on technology originally invented in the 1970s. Their technology might be old, but databases play a crucial role in our increasingly information-laden world. They are designed to store and retrieve information easily, quickly and reliably.
With the growth of the World Wide Web, many more people have begun to realize how useful a relational database can be. Personalized web pages, shopping carts, calendar/diary sites, stock portfolios and book recommendations are all possible because of the marriage between databases and the Web.
While creating and publishing a web site is relatively inexpensive, databases are normally expensive to buy, require costly hardware, and occupy one or more full-time database administrators. No wonder companies can charge outrageous sums of money for a database—anyone who can afford to install and maintain one can also afford the five-digit purchase price.
The tide is beginning to turn, however, and MySQL & mSQL are two at the forefront of a movement to popularize database use. They can be installed within minutes, require low maintenance, and have outstanding performance. Moreover, they support most of the standard SQL (Structured Query Language) syntax used on larger databases. This means anyone trained on a larger database system will be able to apply that knowledge with MySQL & mSQL. The reverse is also true; MySQL & mSQL allow someone to learn the basics of a relational database before working with Oracle, Sybase, DB2 and other large-scale products.
MySQL & mSQL, new from O'Reilly and Associates, is a good book for someone looking to use one or both of these products. It has an excellent introduction to the theory behind relational databases and explains data normalization—a crucial aspect of good database design—in a relatively clear and concise way. It describes SQL data types, giving frequent examples of how they could be used. I normally use MySQL, and thus, the mSQL portions of the book were irrelevant to my day-to-day work. Nevertheless, I found it useful to see how the two differ and what I might gain or lose by switching. Someone inexperienced with database programming would find it hard to decide between the two, based on the coverage given in this book.
MySQL and mSQL begins by describing databases in general, and then concentrates on these two database products in particular. The book continues with a look at database programming from a number of perspectives, including a wide variety of languages (C, C++, Java, Perl, Python and PHP). Finally, it provides a reference to SQL and several language-specific APIs.
That said, several things about MySQL & mSQL troubled me. I was surprised that the example CGI programs did not use the -T (taint) flag, which can significantly increase a program's security. I would also have preferred to see a longer description of Perl's DBI (database interface), instead of using space for a description of the old Mysql.pm module.
I am starting to learn Python and was happy to see that MySQL & mSQL included a chapter on the subject. Unfortunately, the book did not tell me where a MySQL module for Python could be found or which module was used in the examples. After an hour of searches, downloads and failed installs, I gave up. The authors could certainly have given clearer instructions on this subject.
I was surprised that the DESCRIBE command, which I use extensively in my work, had only one mention in the index—and that pointed to an empty entry in the book's SQL reference.
Beginning users probably need a short, step-by-step demonstration of how to CREATE a table, INSERT a row into it, UPDATE one of its columns, DELETE the row, and finally, DROP the table. MySQL & mSQL describes such commands in great detail, but gives few examples of interactive database commands.
Perhaps my biggest problem with MySQL & mSQL is its lack of attention to potential problems when using these low-end databases. I have been using MySQL for several years, and will continue to use it for many applications, both for myself and my clients. But it lacks useful items such as triggers, stored procedures and nested SELECT statements. More importantly, it lacks transactions and constraints, which help to ensure data safety.
Relational databases typically require much horsepower and maintenance, and the authors would have been wise to give a longer indication of why this is the case. In particular, it would have been nice to read more about transactions, and under what circumstances the added expense of Oracle or Sybase pales in comparison with corporate liability.
Despite its flaws, MySQL & mSQL is a welcome book. It provides far better documentation than has previously been available for these products, and gives a push in the right direction to programmers who are new to relational databases. If you are interested in writing applications that use a database, MySQL & mSQL is a good place to start.