Errata

Learning MySQL

Errata for Learning MySQL

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.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

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

Version Location Description Submitted by Date Submitted
228
middle

Page number is approximate - I'm reading the book in Safari app on android tablet. Error is in 3rd paragraph from end of 'Table Aliases' section.

The code for finding duplicate album names is wrong. It finds the duplicates but displays the wrong artist_id, album_id values. To demonstrate, insert a duplicate album_name and run the code in the book:

insert into album values (2, 2, 'Brotherhood');
select a1.artist_id, a2.album_id from album as a1, album as a2 where a1.album_name = a2.album_name and a1.artist_id != a2.artist_id;

artist_id album_id
2 7
1 2

it should be

2 2
1 7

The correct code is:

select a1.artist_id, a1.album_id from ... (remainder is ok)
or
select a2.artist_id, a2.album_id from ....

Jeff Dwork  Aug 02, 2014 
PDF Page 186
Creation of "rose" example database

Database query :
CREATE DATABASE rose DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_cs; should be
CREATE DATABASE rose DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;

"latin1_swedish_cs" in non existent collation.

Danijel Maksimovic  May 15, 2014 
PDF, Mobi Page 559
top of page

External links http://localhost/cgi-bin/HelloWorld.cgi.pl and http://localhost/xampp/HelloWorld.cgi.pl are broken.

Anonymous  Sep 23, 2013 
Printed Page 209
Example in bottom

PRIMARY KEY (artist_id, album_id)

should be changed to

PRIMARY KEY (album_id, artist_id)

otherwise ERROR i.e. start PRIMARY KEY definition with the column that have the AUTO_INCREMENT.

tomas.lindstrom@isoft.se  Sep 08, 2012 
Printed Page 1
This is an issue with the music data base example

I am unable to test out the examples in the book because the music database that you provide does not seem to be creditable. If I enter it exactly as downloaded from the books website, I get the following behavior:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3077
Server version: 5.5.20 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> drop database if exists music
-> ;
Query OK, 2 rows affected (0.18 sec)

mysql> create database music;
Query OK, 1 row affected (0.00 sec)

mysql> use music;
Database changed
mysql> create table artist (
-> artist_id SMALLINT(5) NOT NULL DEFAULT 0,
-> artist_name CHAR(128) DEFAULT NULL,
-> PRIMARY KEY (artist_id)
-> );
Query OK, 0 rows affected (0.10 sec)

mysql> CREATE TABLE album (
-> artist_id SMALLINT(5) NOT NULL DEFAULT 0,
-> album_id SMALLINT(4) NOT NULL DEFAULT 0,
-> album_name CHAR(128) DEFAULT NULL,
-> PRIMARY KEY (artist_id,album_id),
-> FOREIGN KEY (artist_id) REFERENCES artist(artist_id)
-> );
Query OK, 0 rows affected (0.13 sec)

mysql> CREATE TABLE track (
-> track_id SMALLINT(3) NOT NULL DEFAULT 0,
-> track_name CHAR(128) DEFAULT NULL,
-> artist_id SMALLINT(5) NOT NULL DEFAULT 0,
-> album_id SMALLINT(4) NOT NULL DEFAULT 0,
-> time DECIMAL(5,2) DEFAULT NULL,
-> PRIMARY KEY (artist_id,album_id,track_id),
-> FOREIGN KEY (artist_id) REFERENCES artist(artist_id),
-> FOREIGN KEY (album_id) REFERENCES album(album_id)
-> );
ERROR 1005 (HY000): Can't create table 'music.track' (errno: 150)
mysql>

Simon Winder  Jan 13, 2012 
Printed Page 16
5th command line entry

$ chmod 644 myfile.txt
should read
$ chmod 600 myfile.txt

since it corresponds to previous example
$ chmod u=rw,g=,o= myfile.txt where
"Here, the group and other users have been assigned no permissions."

Anonymous   
Printed Page 85
under "Starting and Stopping Apache"

I am using version 10.2 of the openSUSE distribution of Linux.

Under this OS, it seems that the proper command for starting and stopping Apache is rcapache2 instead of apachectl. Using the later does not update the files under /etc/apache2/sysconfig.d/ from the /etc/sysconfig/apache2 configuration file. This results in two errors.

First, Apache won't start because it is missing the /etc/apache2/sysconfig.d/include.conf file. You'll see the error message "httpd2: Syntax error on line 188 of /etc/apache2/httpd.conf: Could not open configuration file /etc/apache2/sysconfig.d/include.conf: No such file or directory"

Second, the /etc/apache2/sysconfig.d/loadmodule.conf is not updated; so, it won't load the PHP module.

Anonymous   
Printed Page 96
line -7

"| 5.0.22 |" -> "| 5.0.22 |"

Anonymous   
Printed Page 97
last line

Move the last line to the next page so the ASCII art box is not split across a page boundary.

Anonymous   
Printed Page 99
2nd paragraph

"by typing rebuild (or using the shortcut characters #)"

should probably be

"by typing rehash (or using the shortcut characters #)"

Anonymous   
Printed Page 145
second query example

The query is:

mysql> SELECT * FROM track WHERE -> track_name LIKE "R__ %";

The problem is the '->'. It shouldn't be there because there is no line break.

It should read:
"mysql> SELECT * FROM track WHERE track_name LIKE "R__ %";

Anonymous   
Printed Page 170
4th paragraph

Reference to "Keys and Indexes" in Chapter 4. "Keys and Indexes" is in Chapter 6.

Anonymous   
Printed Page 183
1st paragraph, 3rd sentence

"The <i>name</i> field is the table name, ..." should be "The <i>name</i> field is
the column name, ..."

Anonymous   
Printed Page 225
First SQL statement at end of first paragraph

The text discussion refers to the use of an unaliased alternative which would require repeating the concatenated columns but the SQL statement defines the 'recording' alias but does not use the alias.

Current:

SELECT CONCAT(artist_name, " recorded ", album_name) AS recording
FROM artist INNER JOIN album USING (artist_id)
ORDER BY CONCAT(artist_name, " recorded ", album_name);

Should be:

SELECT CONCAT(artist_name, " recorded ", album_name)
FROM artist INNER JOIN album USING (artist_id)
ORDER BY CONCAT(artist_name, " recorded ", album_name);

Anonymous   
Printed Page 254
4th paragraph

"<> ANY" and "!= ANY" do not have the alias "NOT IN".
"NOT IN" is actually an alias for "<> ALL".

Anonymous   
Printed Page 255
Using ALL: 2nd paragraph

While the ANY keyword returns values that satisfy at least one condition (Boolean OR), the ANY keyword returns values when all the conditions are satisfied (Boolean AND).

I think this should be changed to say:

While the ANY keyword returns values that satisfy at least one condition (Boolean OR), the ALL keyword returns values when all the conditions are satisfied (Boolean AND).

Anonymous   
Printed Page 483
Bottom of page

if (crypt($password, substr($username, 0, 2)) != $row["password"])
{
// No, so redirect the browser to the login page with a
// message
$message = "This user exists, but the password submitted is incorrect. ".
"Choose another username, or fix the password.";

Always returns: "Choose another username, or fix the password if previously logged in. Have not figured out what the problem is here because it makes logical sense, but there is something about it not recognizing that there is a value there or that it can not recognized the encrypted value--I'm running this on a Mac, with PHP 5.2 but I don't think that is the prolem. Would appreciate the solution!

Again, need to have your downloads and the files in the book tested by someone not familiar with the process.

Anonymous   
Printed Page 506
bottom of page

Should be:
// Try to unreserve the gift with the matching username and gift ID
$query = "UPDATE gifts SET username = NULL WHERE gift_id = {$gift_id}".
" AND username='{$_SESSION['username']}'";

Notice the ' after username= and after }, other wise returns no value and you get an error statement from mySQL telling you there is an error in the where statement.

Makes me think no one tested or has downloaded the sample...

Anonymous   
Printed Page 583
Symbols section of index

All the symbols seem to be Perl and PHP operators. Why aren't SQL operators listed? Or maybe there is a worse problem: I can't find a list of SQL operators in the book.

Anonymous