Errata

MySQL Cookbook

Errata for MySQL Cookbook, Third Edition

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Mobi

Approx. Kindle location 553

'For additional information about executing SQL statements, see Recipes and .'

should read

'For additional information about executing SQL statements, see Recipes 1.5 and 1.6.'

(PDF page 6 is correct)

Note from the Author or Editor:
Thank you for catching this formatting error...this and the other missing xrefs will be corrected in the April 2015 update to this book.

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 3360

''I want to defer the complications of NULL value processing to Recipes and .'

should read

'I want to defer the complications of NULL value processing to Recipes 2.5 and 2.7.'

(PDF page 66 is correct)

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 6423

'NULL values also behave specially with respect to sorting and summary operations. See Recipes and .'

should read

'NULL values also behave specially with respect to sorting and summary operations. See Recipes 7.11 and 8.6.'

(PDF page 116 is correct)

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 6535

''Other examples appear elsewhere: subqueries are used in various examples throughout the book (for example, Recipes and )'

should read

'Other examples appear elsewhere: subqueries are used in various examples throughout the book (for example, Recipes 3.10 and 8.3)'

(PDF page 119 is correct)

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
PDF, Mobi

Approx. Kindle location 8149 and PDF page 163.

The following alternation matches strings that begin with a vowel or end with er:

mysql> SELECT name FROM metal WHERE name REGEXP '^[aeiou]|d$';

+------+
| name |
+------+
| gold |
| iron |
| lead |
+------+

should read

'The following alternation matches strings that begin with a vowel or end with d:

mysql> SELECT name FROM metal WHERE name REGEXP '^[aeiou]|d$';

+------+
| name |
+------+
| gold |
| iron |
| lead |
+------+

Note from the Author or Editor:
Make suggested change.

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 8786

Recipes and discuss ordering and grouping techniques for date-based values.

should read

Recipes 7.5 and 8.12 discuss ordering and grouping techniques for date-based values.

(PDF page 183 is correct)

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 9418

'This is often useful or necessary for performing temporal arithmetic operations (see Recipes and ).

should read

This is often useful or necessary for performing temporal arithmetic operations (see Recipes 6.11 and 6.12).

(PDF page 201 is correct)

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 10626

Paradoxically, you can even use ORDER BY to disorder a result set, which is useful for randomizing the rows or (in conjunction with LIMIT) for picking a row at random from a result set (see Recipes and ).

should read

Paradoxically, you can even use ORDER BY to disorder a result set, which is useful for randomizing the rows or (in conjunction with LIMIT) for picking a row at random from a result set (see Recipes 15.7 and 15.8).

(PDF page 235 is correct)

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 12966

In addition to the stored programs shown in this chapter, others can be found elsewhere in this book. See, for example, Recipes , , , and .

should read

In addition to the stored programs shown in this chapter, others can be found elsewhere in this book. See, for example, Recipes 5.6, 6.3, 14.8, and 23.2.

(PDF page 309 is correct)

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 13498

describes the special TIMESTAMP and DATETIME initialization and update properties enable you to record row-creation and row-modification times automatically.

should read

Recipe 6.7 describes the special TIMESTAMP and DATETIME initialization and update properties enable you to record row-creation and row-modification times automatically.

(PDF page 320 is correct)

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 17030

To export a query result as an Excel spreadsheet or XML document, see Recipes and .

should read

To export a query result as an Excel spreadsheet or XML document, see Recipes 11.8 and 11.9.

(PDF page 285 is correct)

Ian Hartnell  Feb 13, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 18082

If a datafile doesn’t satisfy these assumptions, you may be able to reformat it first using the cvt_file.pl and cvt_date.pl utilities described in Recipes and .

should read

If a datafile doesn’t satisfy these assumptions, you may be able to reformat it first using the cvt_file.pl and cvt_date.pl utilities described in Recipes 11.6 and 12.12.

(PDF page 405 is correct)


Ian Hartnell  Feb 13, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 24221

Recipes and further demonstrate the use of INSERT … ON DUPLICATE KEY UPDATE for initializing and updating counts.

should read

Recipes 13.12 and 20.12 further demonstrate the use of INSERT … ON DUPLICATE KEY UPDATE for initializing and updating counts.

(PDF page 556 is correct)

Ian Hartnell  Feb 13, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 29006

It’s possible to hardwire these elements into a script, but Recipes and describe how MySQL helps you create the elements on the fly from information stored in your database.

should read

It’s possible to hardwire these elements into a script, but Recipes 20.2 and 20.3 describe how MySQL helps you create the elements on the fly from information stored in your database.

(PDF page 653 is correct)

Ian Hartnell  Feb 13, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 30652

Generate these fields the same way as described in Recipes and , except set the default values from the contents of record 1.

should read

Generate these fields the same way as described in Recipes 20.2 and 20.3, except set the default values from the contents of record 1.

(PDF page 676 is correct)

Ian Hartnell  Feb 13, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 30920

For Ruby, PHP, or Python, create the form using the utility functions developed in Recipes and . See the cow_edit.rb, cow_edit.php, and cow_edit.py scripts for details.

should read

For Ruby, PHP, or Python, create the form using the utility functions developed in Recipes 20.2 and 20.3. See the cow_edit.rb, cow_edit.php, and cow_edit.py scripts for details.

(PDF page 679 is correct)

Ian Hartnell  Feb 13, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 30959

Recipes and cover the second and third stages.

should read

Recipes 20.6 and 20.7 cover the second and third stages.

(PDF page 680 is correct)

Ian Hartnell  Feb 13, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 31654

Recipes and process parameters submitted via URLs.

should read

Recipes 20.10 and 20.11 process parameters submitted via URLs.

(PDF page 693 is correct)

Ian Hartnell  Feb 13, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 32681

Recipes and show how to obtain this information using statement metadata and information from the script’s environment.

should read

Recipes 10.6 and 20.1 show how to obtain this information using statement metadata and information from the script’s environment.

(PDF page 709 is correct)

Ian Hartnell  Feb 13, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 35213

For information about plug-in and logging options in particular, see Recipes and .

should read

For information about plug-in and logging options in particular, see Recipes 22.2 and 22.3.

(PDF page 759 is correct)

Ian Hartnell  Feb 13, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 35280

Discussion elsewhere describes specific plug-ins and what they can do for you, including the authentication plug-ins (see Recipe 23.1), and validate_password (see Recipes and ).

should read

Discussion elsewhere describes specific plug-ins and what they can do for you, including the authentication plug-ins (see Recipe 23.1), and validate_password (see Recipes 23.3 and 23.4).

(PDF page 760 is correct)

Ian Hartnell  Feb 13, 2015  Apr 03, 2015
Mobi

Approx. Kindle location 35361

For any log that you enable, see also Recipes and for log maintenance techniques. Logs increase in size over time, so you’ll want to have a plan for managing them.

should read

For any log that you enable, see also Recipes 22.4 and 22.5 for log maintenance techniques. Logs increase in size over time, so you’ll want to have a plan for managing them.

(PDF page 763 is correct)

Ian Hartnell  Feb 13, 2015  Apr 03, 2015
PDF
Page 126
2nd to last paragraph

"To resulting statement…" should be "The resulting statement…"

Note from the Author or Editor:
Make suggested change.

Brian Drye  Oct 05, 2014  Apr 03, 2015
PDF, Mobi
Page 195
3rd paragraph

Approx. Kindle location 9200 and PDF page 195

MySQL includes many functions for extracting date and time subpart extraction.

should read

MySQL includes many functions for extracting date and time subparts.

Note from the Author or Editor:
Make suggested change.

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
PDF, Mobi
Page 222
2nd paragraph from end of page

Approx. Kindle location: 10111

To determine the date of some weekday in a week relative to that of the target date, modify the preceding procedure a bit. First, determine the date of the desired weekday in the target date. Then shift the result into the desired week.

should read

To determine the date of some weekday in a week relative to that of the target date, modify the preceding procedure a bit. First, determine the date of the desired weekday in the week containing the target date and then shift the result into the desired week.

Note from the Author or Editor:
Make suggested change.

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
PDF, Mobi
Page 298
1st line of page

Approx. Kindle location 12549

+--------+----------+
| N | 8 |
+--------+----------+
But eight state names also begin with N.

should read

+--------+----------+
| M | 8 | <-- M instead of N in query result
+--------+----------+
But eight state names also begin with N.

Note from the Author or Editor:
Make suggested change (replace N with M in query result).

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
PDF, Mobi
Page 333
ist code example

Approx. Kindle location: 14205

CREATE TABLE contact_info
(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(30), # state of residence
state CHAR(2), # state of residence
email VARCHAR(50), # email address
url VARCHAR(255), # web address
PRIMARY KEY (id)
);

should read

CREATE TABLE contact_info
(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(30), # name of person
state CHAR(2), # state of residence
email VARCHAR(50), # email address
url VARCHAR(255), # web address
PRIMARY KEY (id)
);

Note from the Author or Editor:
Make suggested change (name VARCHAR(30), # name of person)

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
PDF, Mobi
Page 337
1st code example and following paragraph

Approx. Kindle location: 14365

UPDATE profile SET cats = 0 WHERE cats = 0;

The MySQL server permits a client to set a connect-time flag to indicate that it wants rows-matched counts, not rows-changed counts. In this case, the row count for the preceding statement would be equal to the number of rows with an arms value of 0, even though the statement results in no net change to the table.

The word 'arms' in the text should be 'cats' as the UPDATE statement does not refer to arms.

Note from the Author or Editor:
change "an arms value" to "a cats value" (with cats in mono font)

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
PDF, Mobi
Page 358
2nd text paragraph

Approx. Kindle location: 15832

'To retrieve only certain types of information, replace SELECT * with the columns of interest'

This statement is not strictly true; the SELECT element should not be replaced. The asterisk should be replace by the names of the columns of interest. A better wording might be...

To retrieve only certain types of information, name the columns of interest.

The example MySQL statement that follows this sentence demonstrates the correct syntax and does not require any change.


Note from the Author or Editor:
Just delete SELECT from the sentence.

Ian Hartnell  Feb 12, 2015  Apr 03, 2015
PDF, Mobi
Page 537
2nd paragraph

Approx. Kindle location 23547

The following table shows a marathon runner’s performance at each stage of a 26-kilometer run.

should read

The following table shows a runner’s performance at each stage of a 26-kilometer run.

(A marathon is 26 miles in length.)

Note from the Author or Editor:
Reader is correct, but let's leave this as is. To update properly, we need to change several paras and query results.

Ian Hartnell  Feb 13, 2015 
PDF, Mobi
Page 613
last paragraph

Approx. Kindle location 26754

To write a utility function for unordered lists, it’s easily derived from a function that generates ordered lists because they differ only in the opening and closing list tags.

should read something like

To write a utility function for unordered lists is easy as it can be derived from the function that generates ordered lists because they differ only in the opening and closing list tags.

(Original is not grammatical.)

Note from the Author or Editor:
Change beginning of sentence to: A utility function for unordered lists is easily derived [rest of sentence unchanged]

Ian Hartnell  Feb 13, 2015  Apr 03, 2015
PDF, Mobi
Page 705
code comments in centre of page

Approx. Kindle location 32372

# To determine whether there is a next page, try to select one more
# record than we need. If we get that many, display only the first
# $per_page records, but add a live "next page" link.

# Select the records in the current page of the result set, and
# attempt to get an extra record. (If we get the extra one, we
# won't display it, but its presence tells us there is a next
# page.)

The comments in the code make the same point twice. Was one being edited into the other but the original never removed?

Note from the Author or Editor:
Yes, we can remove the second comment.

Ian Hartnell  Feb 13, 2015  Apr 03, 2015
PDF, Mobi
Page 745/746
sentence spans change of page

Approx. Kindle location: 34651

Older sessions are considered expired and candidates for removal, which is easily done by deleting session records having a timestamp older than the current time more than the permitted lifetime:

Rather than explain the code example that follows it, I had to read the code example to work out what this sentence means; the reader shouldn't have to work that hard!

Consider rewording this sentence.

Note from the Author or Editor:
The sentence has a missing word, insert "by" before "more than". But we can also split into two sentences:
Older sessions are considered expired and candidates for removal. This is easily done by deleting session records having a timestamp older than the current time by more than the permitted lifetime:

Ian Hartnell  Feb 13, 2015  Apr 03, 2015
Mobi
Page 788
3rd paragraph

Approx. Kindle location 35361

It requires the helper routines exec_stmt() and server_version() from Recipes and .

should read

It requires the helper routines exec_stmt() and server_version() from Recipes 9.9 and 10.9.

(PDF page 788 is correct although it does split exec_stmt() across two lines.)

Ian Hartnell  Feb 13, 2015  Apr 03, 2015
Mobi
Page 797

Approx. Kindle location 36715

For information about the sha256_password and validate_password plug-ins, see Recipes and .

should read

For information about the sha256_password and validate_password plug-ins, see Recipes 23.2 and 23.4.

(PDF page 797 is correct although validate_password is split over two lines.)

Ian Hartnell  Feb 13, 2015  Apr 03, 2015