Amazon.com: Customer Reviews: MySQL Cookbook
Your Garage Best Books of the Month Amazon Fashion Learn more Discover it Adele Fire TV Stick Sun Care Patriotic Picks Shop-by-Room Amazon Cash Back Offer roadies roadies roadies  Amazon Echo  Echo Dot  Amazon Tap  Echo Dot  Amazon Tap  Amazon Echo Starting at $49.99 All-New Kindle Oasis UniOrlando Segway miniPro STEM

Customer Reviews

4.6 out of 5 stars36
Your rating(Clear)Rate this item


There was a problem filtering reviews right now. Please try again later.

on December 9, 2004
I built several web sites using PHP/MySQL and the only two books I use day-to-day are "MySQL Cookbook" and "PHP Cookbook".

If you're already somewhat familiar with MySQL, this book is a great reference for the SQL and database manipulation you already know how to do. In addition, the examples push the envelope of what is possible with MySQL making it a good learning tool for becoming truly expert.

Some of the information in the book I found useful includes:

- simplifying complex SQL using temporary tables.

- using FULLTEXT searches (similar to pattern matching but more efficient and easier to code when you're looking for the same text in several columns at the same time).

- effective use of LEFT JOIN's for finding rows in one table that don't have a match in another table.

- effective use of LAST_INSERT_ID( fieldName + 1 ) for transactionally updating a numeric field without using transactions and without locking a table.

- numbering output rows using SQL variables (select @rownum := @rownum + 1; (see chapter 13.9))

I really can't say enough good things about this book. It's comprehensive, easy to read and just plain awesome.
0Comment|37 people found this helpful. Was this review helpful to you?YesNoReport abuse
on May 20, 2003
There are many databases out there. MySQL is one of the better ones. It's a free (for personal use) database system which can be easily integrated into a web application on virtually any system. It has supports most of the standard feature found in most database system and has quiet a few features unique to MySQL. This particular book is a good reference for the experienced user as well as for new comers and as an added bonus even covers MySQL 4.0.
This is book was my first introduction to O'Reilly's cookbook series. It provides solutions to some of the most common challenged faced by the particular subject being covered (in this case MySQL). I thoroughly enjoyed it and was quiet impressed with it. Too many technical books simply introduce the concept without relating it to real world applications.
This particular book introduces all of the most basic concepts of database manipulation (table creation, data insertion, data deletion, data update). As well as writing simple and advanced SQL statements to retrieve data. It approaches database design using 4 of the most popular languages (Perl, PHP, Python and Java). These are only a few of the many possible languages which can be used to manipulate a MySQL database.
MySQL cookbook touches on a variety of different topics which I don't have the space or time to cover in detail, but here is a list of them:
* Handeling duplicates
* MySQL on the Web
* Processing Web input with MySQL
* Using MySQL-based Web Session Management
One of my favorite topics covered in the book is the idea of storing binary data such as images within a database. Although not ideal for most cases (unless you need fast access to a vast array of images), just the idea of it has a certain kewlness effect.
Well, overall I give it 4 out of 5 stars. It needs to touch slightly more on the basic concepts of databases, and it can become the only book you'll ever need for MySQL.
0Comment|17 people found this helpful. Was this review helpful to you?YesNoReport abuse
on April 13, 2003
As an experienced Oracle DBA I had a need to learn about MySQL for the development of the FmPro Migrator utility to migrate FileMaker databases to MySQL. This book enabled me to quickly learn how to perform tasks in MySQL which are equivalent to what I would perform with Oracle. Congratulations to O'Reilly and Paul DuBois for continuing the fine tradition of Cookbook series books.
0Comment|13 people found this helpful. Was this review helpful to you?YesNoReport abuse
on April 5, 2004
I am an experienced web developer and recently started using Perl with MySQL to build database-driven CGI applications.
MySQL Cookbook by Paul DuBois turned out to be a valuable reference resource.
While the title mentions only MySQL, the book provides a great deal of solutions (and code) for using MySQL with Perl, PHP, Python and Java. If you are familiar with any of these computer languages, this book and MySQL manual is all you need to start building applications with MySQL-compatible database backend.
0Comment|23 people found this helpful. Was this review helpful to you?YesNoReport abuse
on November 11, 2002
This book is well done, clearly written and sensibly organized. I read the same author's New Riders Book on MySQL and found it similarly useful; but if you've already got all the theory down, this may well be the only MySQL book you'll need. Wish I'd had it a few years ago.
0Comment|13 people found this helpful. Was this review helpful to you?YesNoReport abuse
This book should be useful for anybody who uses MySQL, ranging from individuals who want to use a database for personal projects such as a blog or Wiki, to professional database and web developers. The book should also appeal to people who do not now use MySQL, but would like to. For example, it should be useful if you want to learn about databases but realize that a "big" database system such as Oracle isn't the best choice as a learning tool. The following paragraphs summarize each chapter to give you an overview of the book's contents.

Chapter 1, Using the mysql Client Program, describes how to use the standard MySQL command-line client. In addition, the chapter discusses other ways to use mysql, such as how to number output lines or make long lines more readable, how to generate various output formats, and how to log mysql sessions.

Chapter 2, Writing MySQL-Based Programs, demonstrates the basic elements of MySQL programming: how to connect to the server, issue queries, retrieve the results, and handle errors. It also discusses how to handle special characters and NULL values in queries, how to write library files to encapsulate code for commonly used operations, and describes various ways to gather the parameters needed for making connections to the server.

Chapter 3, Selecting Data from Tables, covers several aspects of the SELECT statement, which is the primary vehicle for retrieving data from the MySQL server: specifying which columns and rows you want to retrieve, performing comparisons, dealing with NULL values, and selecting one section of a query result.

Chapter 4, Table Management, covers table cloning, copying results into other tables, using temporary tables, and checking or changing a table's storage engine.

Chapter 5, Working with Strings, describes how to deal with string data. It covers character sets and collations, string comparisons, dealing with case-sensitivity issues, pattern matching, breaking apart and combining strings, and performing FULLTEXT searches.

Chapter 6, Working with Dates and Times, shows how to work with temporal data. It describes MySQL's date format and how to display date values in other formats. It also covers how to use MySQL's special TIMESTAMP data type, how to set the time zone, conversion between different temporal units, how to perform date arithmetic to compute intervals or generate one date from another, and leap-year calculations.

Chapter 7, Sorting Query Results, describes how to put the rows of a query result in the order you want. This includes specifying the sort direction, dealing with NULL values, accounting for string case sensitivity, and sorting by dates or partial column values. It also provides examples that show how to sort special kinds of values, such as domain names, IP numbers, and ENUM values.

Chapter 8, Generating Summaries, shows techniques that are useful for assessing the general characteristics of a set of data, such as how many values it contains or what its minimum, maximum, or average values are.

Chapter 9, Obtaining and Using Metadata, discusses how to get information about the data that a query returns, such as the number of rows or columns in the result, or the name and type of each column. It also shows how to ask MySQL what databases and tables are available or find out about the structure of a table and its columns.

Chapter 10, Importing and Exporting Data, describes how to transfer information between MySQL and other programs.

Chapter 11, Generating and Using Sequences, discusses AUTO_INCREMENT columns, MySQL's mechanism for producing sequence numbers. It shows how to generate new sequence values or determine the most recent value, how to resequence a column, how to begin a sequence at a given value, and how to set up a table so that it can maintain multiple sequences at once. It also shows how to use AUTO_INCREMENT values to maintain a master-detail relationship between tables, including some of the pitfalls to avoid.

Chapter 12, Using Multiple Tables, shows how to perform joins, which are operations that combine rows in one table with those from another. It demonstrates how to compare tables to find matches or mismatches, produce master-detail lists and summaries, enumerate many-to-many relationships, and update or delete rows in one table based on the contents of another.

Chapter 13, Statistical Techniques, illustrates how to produce descriptive statistics, frequency distributions, regressions, and correlations. It also covers how to randomize a set of rows or pick a row at random from the set.

Chapter 14, Handling Duplicates, discusses how to identify, count, and remove duplicate rows--and how to prevent them from occurring in the first place.

Chapter 15, Performing Transactions, shows how to handle multiple SQL statements that must execute together as a unit. It discusses how to control MySQL's auto-commit mode, and how to commit or roll back transactions, and demonstrates some workarounds you can use for non-transactional storage engines.

Chapter 16, Using Stored Routines, Triggers, and Events, describes how to write stored functions and procedures that are stored on the server side, triggers that activate when tables are modified, and events that execute on a scheduled basis.

Chapter 17, Introduction to MySQL on the Web, gets you set up to write web-based MySQL scripts. Web programming enables you to generate dynamic pages from database content or collect information for storage in your database. The chapter discusses how to configure Apache to run Perl, Ruby, PHP, and Python scripts, and how to configure Tomcat to run Java scripts written using JSP notation. It also provides an overview of the Java Standard Tag Library (JSTL) that is used heavily for JSP pages in the following chapters.

Chapter 18, Incorporating Query Results in Web Pages, shows how to use the results of queries to produce various types of HTML structures, such as paragraphs, lists, tables, hyperlinks, and navigation indexes. It also describes how to store images into MySQL, and retrieve and display them later, and how to send a downloadable result set to a browser. The chapter also includes a section that demonstrates how to use a template package to generate web pages.

Chapter 19, Processing Web Input with MySQL, discusses how to obtain input from users over the Web and use it to create new database rows or as the basis for performing searches. It deals heavily with form processing, including how to construct form elements, such as radio buttons, pop-up menus, or checkboxes, based on information contained in your database.

Chapter 20, Using MySQL-Based Web Session Management, describes how to write web applications that remember information across multiple requests, using MySQL for backing store.

Appendix A, Obtaining MySQL Software, indicates where to get the source code for the examples shown in this book, and where to get the software you need to use MySQL and write your own database programs.

Appendix B, Executing Commands from the Command Line, provides background on executing commands at the command prompt and how to set environment variables such as PATH.

Appendix C, JSP and Tomcat Primer, provides a general overview of JSP and installation instructions for the Tomcat web server.

Appendix D, References, lists sources of information that provide additional information about topics covered in this book. It also lists some books that provide introductory background for the programming languages used here.
0Comment|11 people found this helpful. Was this review helpful to you?YesNoReport abuse
on March 11, 2008
As indicated, this book is true to its title. It is a cookbook, by which I mean it contains a great number of (generally useful) recipes of varying complexity, but lacks detail and analysis that a more focused text would have.

Mr. DuBois and O'Reilly publishing are clearly targeting a wide audience: the recipes range from frighteningly simple (e.g. 3.1, Specifying Which Columns to Select) to fairly sophisticated (e.g. 12.14, Performing a Join Between Tables in Different Databases). The recipes are typically clearly written, with ample supporting code examples and few typographical errors.

I must also note that Mr. DuBois nicely avoids a pitfall many authors (the competence of whom I have to question) in this genre encounter: failure to weave security considerations into the text. While other books often mention security as an afterthought, or worse include code examples featuring disasters like non-escaped strings (hello, SQL injection!), DuBois explicitly points out the need to sanitize input and writes code examples that demonstrate the use of prepared statements in best-practices.

Unfortunately, in other areas he is less thorough. For example, only passing mention is made of the (possible) dependence of FULLTEXT indexes on choice of storage engine. There is an entire chapter on handling duplicate rows, but the oft-needed (and non-obvious) process for removing pseudo-duplicate rows differing only by a primary key field is not directly addressed. Stored procedures, triggers, and other new additions to MySQL are among the least-well understood but most powerful features of the database engine, yet astonishingly little space is spent on them. (I could understand not discussing them in depth as there are other books available, but length did not seem to be a concern anywhere else in this book.)

In summary, the book is an excellent resource for novices and experts alike - but only as a starting point. To return to the cooking analogy, the book at times feels like it is loaded down with recipes on how to add sugar to flour, but omits recipes on how to ice the cake.
0Comment|5 people found this helpful. Was this review helpful to you?YesNoReport abuse
on February 3, 2003
This book is full of examples. This is perfect for a learn-by-example programmer like me. It makes a handy reference, too. He has examples and tips for just about everything the typical MySQL coder would ever need to do. Excellent reference - I highly recommend it.
0Comment|14 people found this helpful. Was this review helpful to you?YesNoReport abuse
on June 3, 2005
I am a big fan of hands-on books. I especially like the `From Scratch` and `Cookbook` type titles.

Well, lucky me. When I attended the 2005 MySQL Users Conference in Santa Clara CA in April '05, I received the "MySQL Cookbook" by Paul DuBois as a reward for early registration.

The day after I returned back to work from the conference, one of my co-workers came looking for some guidance in regards to a MySQL database issue he was having. His description sounded familiar to one of the recipes I skimmed in the cookbook. Sure enough, I found the resolution within two minutes, and had sent
another satisfied customer on his way.

The great aspect of this book is that it is written to provide solutions to over 315 real-world problems. Whenever I come up against an obstacle in regards to MySQL, I head straight to the table of contents and scan for a recipe that looks like it might be a match.

One topic I wish was covered somewhere in this text is the concept of derived tables, which are basically sub-queries used as tables in a join.

(...)
The "MySQL Cookbook" and "MySQL in a Nutshell" books are permanent fixtures in my office ... except for when my co-workers borrow them.

-Brett Berry
PERL/PHP/JavaScript/MySQL
(...)
0Comment|14 people found this helpful. Was this review helpful to you?YesNoReport abuse
on November 23, 2011
This book is huge and like the other books in the cookbook series the primary purpose of the book is to provide real solutions to real life problems. One of the reasons for the huge size of this book is that it takes the programming language that is being used with mySQL into account and provides coding solutions for not just one but five of the most popular programming languages that are used with mySQL databases. Even if you aren't using one of those five most of the other languages that can be used with mySQL will at least resemble one or more of the languages that is covered to allow you to work out how to convert the presented solutions into just about any programming language.

This is not a book to teach you mySQL, it is the book that you get after you already have at least some knowledge of mySQL and are starting to face real problems of how to use mySQL to solve specific problems. It doesn't teach you how to design databases either so it wont help you in working outhow what tables you should have and what to put in each. What it will do is to help you work out how to use those tables most effectively once you have finished designing your database. It will also assist you in working out what data types to use for the fields that you have in your table and how to make your database accesses more efficient by setting up your database queries to work in the most effective way reducing the need for as much programming code around the call to perform the required task.
0Comment|2 people found this helpful. Was this review helpful to you?YesNoReport abuse