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.
| Version |
Location |
Description |
Submitted By |
| Printed |
Page p106
Results box |
On Page 106 the query is:
SELECT drink_name FROM drink_info
WHERE
calories BETWEEN 30 AND 60;
The results include "Soda and It."
However, based on the table on page 105, "Soda and It" only has 19 calories and should not be included in the results set.
The only ones that should be in the results are:
Blackthorn
Oh My Gosh
Greyhound
Indian Summer
|
Anonymous |
| Printed |
Page 87
Bottom Right |
In the bottom right of the page, the Greater to or Equal sign is listed as =>, should be >= (this is used correctly on the next page in demonstration)
|
Laurel Raven |
| Printed |
Page 106
select clause |
Hi ,
On Page 106 we learned that ... calories between 30 and 60 will return drinks with 30 and 60.
On Page 108 we learned that ... drink_name between 'G' and 'O' will not return drinks with 'O'
Shouldn't drinks with 'O' have been included just like calories with 60 are included. Not sure I understand.
cheers
David
|
David |
| Printed |
Page 107
First problem description |
Pedantic, but because you are in the "conditional" section of the book ...
"... drinks that have more than 60 calories and less than 30." doesn't have a solution if you take it literally (i.e. drinks that are > 60 and < 30 calories). This line should probably read:
... drinks that have more than 60 calories or less than 30." which also better reflects the provided answer.
|
Anonymous |
| Printed |
Page 111
Answer to fourth question |
"If you wanted to use it in and AND or OR clause ..."
should probably read
"If you wanted to use it in an AND or OR clause ..."
[change and => an]
|
Anonymous |
| Printed |
Page 119
Entire chapter |
Just a nit. It seems like the clown_info tables are missing a table name heading in the examples. The "other" tables seem to be (mostly) labeled whenever they are presented.
|
Anonymous |
| Printed |
Page 126
First sentence |
"Our clown trackers work on a vounteer basis."
should be
"Our clown trackers work on a volunteer basis."
[vounteer => volunteer ]
|
Anonymous |
| Printed |
Page 129-131
entire pages |
The example on page 129 (for the delete statement) shows the rows in a table for 'Zippo' the clown. According to the first paragraph we are trying to get rid of duplicate records. The exercise on the page is 'Delete Statement Magnets'. The solution shown on the next page (130) shows a delete statement to {DELETE FROM clown_info WHERE activities = 'dancing';} To my mind, this would delete the one non-duplicated row from the table on page 129. However, the table on page 131 shows an entirely different set of records in the table. Admittedly, it does highlight the one row which is actually deleted if the statement (for the solution on 130) is used on the table shown on that page. However, the whole solution has pretty much nothing to do with duplicate records or the example table on page 129.
I reread the 3 pages several times before I realized that perhaps I did not read the instructions for the exercise on pg 129 closely enough; it stated 'a simple command that we could use to get rid of 'ONE' of the Zippo records'. I had assumed the exercise followed from the table above it, especially since the paragraphs at the top of pg 129 stated 'we should only have one row per clown' and we should 'get rid of some of the old Zippo records'. Just above the exercise it even shows the 'rows for Zippo' again', with many duplicated records. I thought the exercise was in reference to that table.
I did understand the 'delete' statement - page 131 alone showed that. I guess it was pages 129 and 130 that threw me off. My understanding of the exercise and the solution on page 130 were so different and the results on page 131 so unexpected, things didn't 'compute' at first. My confusion could certainly have been due to the way my mind works, but things would have actually been clearer if pages 129 and 130 had not been there at all.
I'm sorry this is so long, it is hard to convey confusion!
|
Mary |
| Printed |
Page 144-145
All pages |
I think the logic here is flawed. The text suggests using the following steps:
1 - Select ...
2 - Insert ...
3 - Delete ...
On page 142, the second query has a good example of a Select query that "picks" both the old and new row. The above logic would not catch this case. The discussion should re-do the logic ordering to:
1 - Insert ...
2 - Select ...
3 - Delete ...
in order to prevent the "new" row from being picked up on DELETE.
|
Anonymous |
| Printed |
Page 219
Whole page |
The following code works better in MySQL version 5.1:
DROP TABLE car_table2;
DROP TABLE hooptie2;
CREATE TABLE `hooptie2` (
`color` varchar(20) default NULL,
`year` varchar(4) default NULL,
`make` varchar(20) default NULL,
`mo` varchar(20) default NULL,
`howmuch` float(10,3) default NULL
);
INSERT INTO `hooptie2` (`color`,`year`,`make`,`mo`,`howmuch`) VALUES ('silver','1998','Porsche','Boxter','17992.539');
INSERT INTO `hooptie2` (`color`,`year`,`make`,`mo`,`howmuch`) VALUES (NULL,'2000','Jaguar','XJ','15995.000');
INSERT INTO `hooptie2` (`color`,`year`,`make`,`mo`,`howmuch`) VALUES ('red','2002','Cadillac','Escalade','40215.898');
DESCRIBE hooptie2;
SELECT * from hooptie2;
ALTER TABLE hooptie2
RENAME TO car_table2,
ADD COLUMN car_id INT NOT NULL AUTO_INCREMENT FIRST,
ADD PRIMARY KEY (car_id),
ADD COLUMN VIN VARCHAR(16) AFTER car_id,
CHANGE COLUMN mo model VARCHAR(20),
CHANGE COLUMN color color VARCHAR(20) AFTER model,
CHANGE COLUMN year year VARCHAR(4) AFTER color,
CHANGE COLUMN howmuch price DECIMAL(7,2);
UPDATE car_table2
SET
VIN = 'RNKLK66N33'
WHERE car_id = 1;
UPDATE car_table2
SET
VIN = 'SAEDA44B'
WHERE car_id = 2;
UPDATE car_table2
SET
VIN = '3GYEK63NT2'
WHERE car_id = 3;
DESCRIBE car_table2;
SELECT * FROM car_table2;
|
John Kraus |
| Printed |
Page 219
Alter command |
The VIN column is sized at 16 characters, but the example database listing (from page 218) uses 17 characters[1]. So, the VIN column should really be:
ADD COLUMN VIN VARCHAR(17) AFTER car_id
Notes:
[1] See http://en.wikipedia.org/wiki/Vehicle_Identification_Number
|
Anonymous |
| Printed |
Page 223
first paragraph on page under Look for patterns |
Final sentence of first paragraph reads: "The that fact it's consistent and follows a pattern will help us break it down so it's more atomic."
"that" and "fact" should be reversed to read: "The fact that it's..."
|
Phillip Reed |
| Printed |
Page 240
'The order does matter' paragraph, second sentence |
We don't know if it should be considered comedy, action, drama, CARTOON, or scifi.
According to the table, 'Paraskavedekatriaphobia' doesn't have a 'T' for cartoon, so it shouldn't be able to have it classified as a cartoon with the given UPDATE queries.
|
Adam Wickliffe |
| Printed |
Page 240
Sharpen your pencil example |
The categories I came up with differ from the book. If you run through the UPDATE queries, in the order provided on page 239, then:
"End of the line" should be in category "?" because it's affected by the drama, horror, sci-fi, and misc updates.
"Shark bait" should be labeled "family" because it's only affected by the "... family where for_kids = T" update.
"Angry Pirate" should be labeled "?" because it's affected by the comedy and misc updates.
|
Anonymous |
| Printed |
Page 244
First sentence |
'Great Adventure' should be 'Big Adventure' and 'R-rated' should be 'PG-rated' in order to match the listing on page 242. Also, the "R-rating" on page 245, in the brain power box, needs to switched as well.
|
Anonymous |
| Printed |
Page 261
2nd para |
The description of the SQL query:
"This query gives us a list of movies ordered by the
purchase date, with the newest ones first. For each
date, the movies purchased on that date are listed in
alphabetical order."
doesn't match the provided query:
SELECT title, purchased
FROM movie_table
ORDER BY title ASC, purchased DESC;
The query first orders by title then purchase date which doesn't match the (above) description. Either the description or the query needs to be changed to match the other.
|
Anonymous |
| Printed |
Page 264
Example query |
The example query:
SELECT first_name, sales
FROM cookie_sales
ORDER BY first_name;
is supposed to order the results by first name (i.e. alphabetical order). The provided results, though, aren't in alphabetical order by first name (e.g. Nicole shows up before Britney).
|
Anonymous |
| Printed |
Page 292
First caption for solution (the 'simpler columns' portion of the query. |
The caption says:
"Regis wants to date a single girl born between 1970 and 1980, who lives in Massachusetts and wants to date a single guy."
All the queries looking for dates for Regis to this point are supposed to and have been written to look for matches within five years of his birthday up and down, which means the years 1950 to 1960. The caption should say:
"Regis wants to date a single girl born between 1950 and 1960, who lives in Massachusetts and wants to date a single guy."
|
Adam Wickliffe |
| Printed |
Page 295
Description, caption and heading for first table |
1) "How the old clown_tracking table ..."
Should probably read
"How the old clown_info table ..."
in order to match the table name from previous chapters (e.g. page 176)
2) The heading for the table should also be changed from
clown_tracking
over to
clown_info
3) The column headers should be shifted to the left by one column. The current column haedings:
clown_info|name|last_seen|activities
should read
name|last_seen|appearance|activities
|
Anonymous |
| Printed |
Page 296
"old" table caption and column headings |
1) The heading for the table should also be changed from
clown_tracking
over to
clown_info
2) The column headers should be shifted to the left by one column. The current column headings:
clown_info|name|last_seen|activities
should read
name|last_seen|appearance|activities
|
Anonymous |
| Printed |
Page 309
last comment on page |
Page 304 has the following statement:
"Foreign keys don’t have to be unique—in
fact, they often aren’t."
So I don't see how the following comment on page 309 logically follows:
"These tables also have a one-to-one relationship, since
the primary key of the employee table, employee_id, is
being used as the foreign key of the salary table."
[Nit: since --> because, above]
In fact, the interests table, which is the subject of the previous pages, has the same setup but is a one-to-many (i.e. many contact_id's in the interest table that map into one contact_id in the my_contacts table).
|
Anonymous |
| Printed |
Page 312
First sentence |
"Many woman ..."
should read
"Many women ..."
|
Anonymous |
| Printed |
Page 314
Sharpen your pencil Solution |
The tables shown as the answer are incorrect.
The first pair of tables show that the only person who has 'Crocs Clogs' is Charlotte.
The answer table shows that Samantha is the only person with 'Crocs Clogs'.
Assuming that the first set of tables is the data the answer should be derived from, I believe the answer will look like this:
------------------------
| woman_id | woman |
------------------------
| 1 | Carrie |
| 2 | Samantha |
| 3 | Charlotte |
| 4 | Miranda |
------------------------
------------------------------------------
| shoe_id | shoe_name | woman_id |
------------------------------------------
| 1 | Manolo Strappies | 2 |
| 2 | Crocs Clogs | 3 |
| 3 | Old Navy Flops | 1 |
| 4 | Prada Boots | 1 |
| 5 | Manolo Strappies | 3 |
| 6 | Manolo Strappies | 4 |
| 7 | Old Navy Flops | 3 |
| 8 | Old Navy Flops | 4 |
| 9 | Prada Boots | 3 |
| 10 | Prada Boots | 4 |
------------------------------------------
|
Adam Wickliffe |
| Printed |
Page 318
4th example |
The exercise asks us what the database relationship is between a book and a publisher (ie is it One to Many, or Many to Many).
The answer given is One to Many, on the assumption that modern books only have one publisher. Usually, this is right.
But what about books like the Bible, or Dickens, or Shakespeare? Some books with lapsed copyrights are published by multiple publishers. Perhaps you could add a pencilled note to the answer mentioning this to avoid confusion.
Thanks. Head First SQL is awesome. Lynn Beighley is my hero :)
|
Durand |
| Printed |
Page 318
All examples |
It would be great if the answers provided some context as well. For example, when I saw the doughnut_rating table (taken in isolation) it appeared to be a one-to-one relationship. I was assuming the following layout:
doughnut_type|rating
-------------+---------
glazed |excellent
boston_cream |good
...
where doughnut_type is a unique, primary key. I'm not sure what the authors were thinking in terms of how this information gets used by other tables. I have the same comment for the other examples too.
[Flipping back through the book (e.g. page 78) shows that doughnut_type is not a primary key, so again, not sure what the author intended, here.]
|
Anonymous |
| Printed |
Page 324
Sharpen Your Pencil Solution |
The book is explaining what functional dependency is. On page 323, functional dependency is defined as "When a column's data must change when another column's data is modified, the first column is functionally dependent on the second".
One example given is that a superhero's initials are dependent on their name. (I agree. If you change your name, you can't help but change your initials)
But other examples given are that the superhero's powers, weakness, and arch-enemy are also dependent on the name. This seems to imply that if superhero changes her name, she'd have to change power, weakness, and arch-enemy, just like she'd have to change initials.
I don't understand why that is true. Couldn't a superhero get a new arch-enemy? And if the superhero changed her name, couldn't her arch-enemy remain the same? And if so, then in what way is arch-enemy functionally dependent on superhero name?
I may have missed something. If there's a simple answer, could you include a "There Are No Dumb Questions" section in the next edition?
|
Durand Sinclair |
| Printed |
Page 340
N/A |
The 2NF definition uses "partial functional depencies" (PFD), but there's no definition for PFD on this page. Probably should add one to this page.
|
Anonymous |
| Printed |
Page 346
All examples |
I believe using DISTINCT versus GROUP BY would make the examples clearer. For example:
SELECT status FROM my_contacts GROUP BY status ORDER BY status
versus
SELECT DISTINCT status FROM my_contacts ORDER BY status
|
Anonymous |
| Printed |
Page 350
Answer table diagram (on page 378) |
The table in the answer for the 'Sharpen your pencil' exercise (on page 378) indicates that the information in the orginal 'interests' column will be gone. However, after the value from 'interests' has been pared down to just the fourth item, it is assigned to the 'interest4' column, but isn't modified afterword (like the SUBSTR function did for the previous three interests). The end result would have 'fourth' as the value in the 'interests' column once the query has been run.
|
Adam Wickliffe |
| Printed |
Page 355
4th para |
"... our new
table will still have a column called profession, not mc_prof."
When I run the following query:
CREATE TABLE profession ( id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, mc_prof VARCHAR(20) ) AS SELECT profession AS mc_prof FROM my_contacts GROUP BY mc_prof ORDER BY mc_prof;
the table produced has a "mc_prof" column which seems to contrqadict the quoted statement, above.
|
Anonymous |
| Printed |
Page 359
Second question 'there are no Dumb Questions' |
The question of 'Say I'd use his query instead:' should read 'Say I'd use this query instead:' (The 't' is missing from the 'his', which would make it 'this').
|
Adam Wickliffe |
| Printed |
Page 362
last two "blank" lines |
"... where the contact_id from my_contacts matches
the id field in the profession table"
Should be changed to
"... where the prof_id field from my_contacts matches
the prof_id field from the profession table"
in order to match the provided field names.
|
Anonymous |
| Printed |
Page 366
The third printed solution. |
A formatting problem with the stylized font in the 3rd solution given on page 366.
Two minor but rather misleading typo/formatting problem where the full stop in
"...z.state FROM my_contacts mc..." and "...z.zip_code;"
has melded with the letter preceding it.
Thus, it looks like 'zstate' and 'z zip_code" respectively to the naked eye.
A slightly elongated 'z' perhaps, but unless you peer very closely at the print, the full stop is practically non-existent.
|
Anonymous |
| Printed |
Page 374
Last solution |
An alternative solution to:
SELECT p.profession FROM my_contacts mc
INNER JOIN profession p ON mc.prof_id = p.prof _ id GROUP BY profession ORDER BY profession;
is
SELECT DISTINCT p.profession
FROM my_contacts
NATURAL JOIN profession p
which seems to me to be more explicit and more concise.
|
Anonymous |
| Printed |
Page 381
job_listings table |
Why isn't job_listings.zip linked (i.e. foreign key) to zip_code.zip_code?
|
Anonymous |
| Printed |
Page 382
last paragraph |
"... But first, he wants to pull out all the
Web Developers with ..."
This statement implies to me that the query should look for people who are currently web developers versus people aspiring to be web developers (which is what the provided solution looks for). Also, the provided solution doesn't check for years of experience, so the requirement needs to be dropped from this page or fixed in the query.
|
Anonymous |
| Printed |
Page 384
Sharpen your pencil Solution |
The information that the SELECT query should be looking for is people who want a job as a 'Web Developer', don't require a salary of more than $105,000, and have 5 or more years of experience.
The answer query doesn't filter for the expected amount of experience. The following line should probably be added to the answer query:
[code]AND jd.experience >= 5[/code]
|
Adam Wickliffe |
| Printed |
Page 388
Graphic examples |
The two graphic, query examples seem identical and have similar annotations, so I don't see what purpose they server. What am I missing, here?
|
Anonymous |
| Printed |
Page 426
SELECT statement in large type |
There is an annotation to the SELECT statement saying that the FROM clause refers to the right table, toys, joined to the left table, girls. Surely the first table referred to is still the left table just as in the left join - it's just that tables are processed the other way round in the right join?
In fact come to think of it I'm confused by the order that things come out in. Going back to the left join, on page 420 the left table is girls but the results come out in order of the right table, toys. But on page 425 the results come out in order of the left table, toys. I happen to be using SQLITE because that's what's on my computer so I can't say what happens with MySQL (and it doesn't do a right join), but the results I get are always ordered on the left table.
|
Anonymous |
| Printed |
Page 437
Second paragraph, last sentence |
The following statement seems incorrect to me:
" Think of the
results of the UNION like they’re the values from
each SELECT that “overlap.”"
The UNION statement doesn't just provide the "overlap" but combines all the results (with duplicates removed).
|
Anonymous |
| Printed |
Page 456
Multiple locations |
1) The job_listings.job_id field is listed as both a primary and foreign key even though it isn't being used as a foreign key.
2) The field interests.interest_id is mapped to contact_interest.contact_id instead of contact_interest.interest_id.
3) The field seeking.seeking_id is mapped to contact_seeking.contact_id instead of contact_seeking.seeking_id.
|
Anonymous |