BUY THIS BOOK
Add to Cart

Print Book $49.99


Add to Cart

Print+PDF $64.99

Add to Cart

PDF $39.99

Safari Books Online

What is this?

Add to UK Cart

Print Book £35.50

What is this?

Looking to Reprint or License this content?

MySQL Cookbook, Second Edition

By Paul DuBois
November 2006
Pages: 975
ISBN 10: 0-596-52708-X | ISBN 13: 9780596527082
starstarstarstarstar (Average of 4 Customer Reviews)

Buy 2 Get 1 Free Free ShippingGuarantee

Book description

A handy resource when you need quick solutions or techniques, this Cookbook addresses specific questions in using MySQL. You'll find dozens of short, focused pieces of code and hundreds of worked-out examples that are perfect for programmers of all levels who don't have the time (or expertise) to solve MySQL problems from scratch. The new edition covers MySQL 5.0 and the older but still widespread MySQL 4.1.
Full Description

Along with MySQL's popularity has come a flood of questions about solving specific problems, and that's where this Cookbook is essential. Designed as a handy resource when you need quick solutions or techniques, the book offers dozens of short, focused pieces of code and hundreds of worked-out examples for programmers of all levels who don't have the time (or expertise) to solve MySQL problems from scratch.

The new edition covers MySQL 5.0 and its powerful new features, as well as the older but still widespread MySQL 4.1. One major emphasis of this book is how to use SQL to formulate queries for particular kinds of questions, using the mysql client program included in MySQL distributions. The other major emphasis is how to write programs that interact with the MySQL server through an API. You'll find plenty of examples using several language APIs in multiple scenarios and situations, including the use of Ruby to retrieve and format data. There are also many new examples for using Perl, PHP, Python, and Java as well.

Other recipes in the book teach you to:



  • Access data from multiple tables at the same time
  • Use SQL to select, sort, and summarize rows
  • Find matches or mismatches between rows in two tables
  • Determine intervals between dates or times, including age calculations
  • Store images into MySQL and retrieve them for display in web pages
  • Get LOAD DATA to read your data files properly or find which values in the file are invalid
  • Use strict mode to prevent entry of bad data into your database
  • Copy a table or a database to another server
  • Generate sequence numbers to use as unique row identifiers
  • Create database events that execute according to a schedule
  • And a lot more

MySQL Cookbook doesn't attempt to develop full-fledged, complex applications. Instead, it's intended to assist you in developing applications yourself by helping you get past problems that have you stumped.

Browse within this book

Cover | Table of Contents




Featured customer reviews

Write a Review


True to the Title,  March 19 2008
Rating: StarStarStarStarStar
Submitted by Conrad Shultz   [Respond | View]

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.


For "anybody who uses MySQL",  December 16 2007
Rating: StarStarStarStarStar
Submitted by Justin Pease   [Respond | View]

Visuals

Good. Page numbers and section title can be found on the bottom of every page.



Audience

From the book: "This book should be useful for anybody who uses MySQL, ranging from individuals [...] to professional database and web developers."



That is a pretty broad range, basically from introductory to advanced. Nevertheless I would have to say that the book meets this challenge well. This book should be of use to anybody who uses MySQL.



Practicality:

I have to say that I have fallen for Cookbook style books. While I still thoroughly enjoy more theory heavy books, cookbooks can really deliver in the immediate practicality department.



The MySQL Cookbook is a good example of this. This book has dozens upon dozens of recipes that will likely have some measure of application in whatever MySQL dependent system you are working on.



Each recipe contains a brief "Problem" scenario, followed by an often equally brief "Solution", and finally a more lengthy discussion that shows how to actually implement the solution.



Overall

I am very pleased with this book. Mr. DuBois and O'Reilly did a great job. For instance, one of the things I especially like is that often multiple solutions are offered. For example if you were to look up Section 6.6 "Extracting Parts of Dates or Times" you will find the solution lists 3 possible options. The discussion section contains 5 pages of examples of how you might use those options to extract the desired data.



If you fit in to the intended audience of "anybody who uses MySQL", I would highly recommend this book.




MySQL help!,  May 27 2007
Rating: StarStarStarStarStar
Submitted by Dave Walz-Burkett   [Respond | View]

The MySQL Cookbook weighs in at over 940 pages and will help you find quick answers to everything from beginner-level basics up through dba and software developer tricks.

The book is a collection of real-world tasks and compliments Paul's DuBois' other MySQL books very well. It goes beyond basic use and admin-level goodies - it has loads of code examples as well. As a software developer using MySQL for many projects, I find the MySQL Cookbook indispensible.

Read all reviews


Thick and Lovely,  March 07 2007
Rating: StarStarStarStarStar
Submitted by Chris Charlton   [Respond | View]

If you deal with MySQL on a daily or weekly basis then this book is a perfect go-to. So many scenarios (recipes) are covered, from simple to fairly advanced.

This second edition is almost twice as thick as the first, but that doesn't mean it's too much to handle since you wouldn't entirely read it from cover to cover because you'll want to go try out so much of it.

This really is worth space on a shelf (digital or not).


Media reviews
"For developers using the MySQL database system, the gold standard of such books is MySQL Cookbook, by Paul DuBois."
-- Michael J. Ross, Web Developer, Slashdot.org


"Here is the most complete compilation of coding examples for programing using MySQL 5.0. The wide ranging examples include the use of Perl, PHP, Python, Java, and Ruby, and provide a rich array of recipes that will enable programmers to more quickly develop sophisticated applications. The author not only provides working code, but explains how the code works, enabling readers to make modifications to fit their particular requirements."
-- Michael Kleper, The Kleper Report on Digital Publishing


"This is indeed a great book, written for all--beginner and professional...It is written with the MySQL developer and web-based programmer at heart. It uses hands-on examples' approach, that is recipes, which makes this book to be exciting and fascinating. The author attempts to present to the reader solutions to real-world problems facing web-based programmers and he does this in a style that is thoroughly explained...sincerely speaking this book is a must read for web programmers and database developers."
-- Emeka, JavaLobby



Read all reviews

See larger cover


"For developers using the MySQL database system, the gold standard of such books is MySQL Cookbook, by Paul DuBois."
--Michael J. Ross, Web Developer, Slashdot.org