Head First SQL by Lynn Beighley This errata page lists errors fixed in the May 2008 reprinting. If you have technical questions or error reports, you can send them to booktech@oreilly.com. Please specify the printing date of your copy. This page was updated May 12, 2008. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification Confirmed errors: (19) In the annotation pointing to the comma in the third line of bolded code at the bottom of the page, "colums" should be "columns". (31) Under there are no Dumb Questions, answer to 3rd Question; In the line "Since there is no data in the table yet, we can simply get rid of the old one away and start over." Delete the word "away," so it just reads "get rid of the old one and start over." {62/63} 4th query/text beneath query: WHERE second = "orange juice"; Answer should be: Hot Gold Changed the annotation to: "This query works and doesn't cause an error even though you used single quotes when you inserted the value." {76} Solution on the lower portion of the page doesn't include possible answer: WHERE drink_name = 'Bull Frog'. Added an annotation to the bottom part of the page: "You could also have used the obvious query SELECT drink_name FROM easy_drinks WHERE drink_name = 'Bull Frog';" (77) First bullet point: removed extra "when" {90} Bottom (last solution); SELECT drink_name, color, ice FROM drink_info WHERE cost >=3.8; Removed "=" from ">=" in solution. Now the solution query reads: SELECT drink_name, color, ice FROM drink_info WHERE cost > 3.8; (90) Bottom (last solution); Capitalization error Changed "LIps" to "Lips" (103-104) Second WHERE statement; Wildcard character '_' stands for just one unknown character. Two letters are missing from Elsie's name 'El'sie. Changed the magnet on 103 and 104 to read: WHERE cow_name LIKE '_lsie'; {108} Middle example comment related to query; The comment says, "We'll get drink names that begin with G and O, and all the letters in between." Solution should read: "... drink_name BETWEEN 'G' AND 'P'..."; Changed the annotation to: "This one is a bit tricky! We need to use the letter after O to make sure we get drink names that begin with O. Test it out and see for yourself." {113,115} First solution incorrect Changed the solution to: SELECT drink_name FROM easy_drinks WHERE main IN ('peach nectar', 'soda'); {115} First solution (the answer) is incorrect Changed to: WHERE main BETWEEN 'P' and 'T'; Also, the first solution annotation was changed to: "You could also have used this WHERE clause: WHERE (BETWEEN 'P' and 'T'); This would have worked because we don't have any other main ingredients that satisfy the condition. But in general when you have a large table in the real world, you won't know what is in it, which is why you are querying in the first place. {134} Answer to question 6; This is an error made in the November 2007 reprint, not the original printing. The line was changed to: WHERE location = 'Snappy Bagel' OR rating = 3; The answer should be "No matches, did not DELETE" and should have no arrows pointing to the table below. (149) UPDATE in action; The text paragraph after the headline "UPDATE in action" does not correctly relate to the SQL statement right after that. The text said: "Using the UPDATE statement, the last_seen columnn of Mr. Hobo's record is changed from Dickson Park to Tracy's" while the text in the last_seen condition in the WHERE clause of the UPDATE statement mentioned "Party for Eric Gray" Changed body text at top of page to read: "...is changed from Party for Eric Gray to Tracy's..." {190} Middle of page; The third INSERT statement in Exercise 3 solution does not complete without error. Annotated third insert statement: This may or may not work for you. On some SQL versions it will give you an error, and on some just a warning such as "Out of range value adjusted for column 'id' at row 1." If you get the error, Bobby's not in your table. With the warning, he will be. (212) Question in "There are no Dumb Questions" section; Question reads, "What if I want ot..." but should be "What if I want to..." {214} First line of SQL code in Exercise solution is incorrect. ALTER TABLE project_table should be: ALTER TABLE project_list {216} Sharpen your Pencil Solution - command: It reads yet: ALTER TABLE project_table ... should be ALTER TABLE project_list ... and the handwritten text above should read as "Here's our table name" [219] ALL OF IT; Code would not complete without error Changed the answer to: ALTER TABLE hooptie RENAME TO car_table, 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), MODIFY COLUMN color AFTER model, MODIFY COLUMN year SIXTH, CHANGE COLUMN howmuch price DECIMAL(7,2); Deleted the bottom annotation on the page. [230] Middle of page left side first paragraph; The line reads "Let's see it in action on this example table. First time through, it takes the location for the first column and operates on it." This should read "first row," not "column." (245/246) Sharpen your pencil; Instructions do not specify to add the G rating as part of the check as the answer implies on pg. 246. Added sentence to end of instructions on 245 and 246: "If a cartoon has a G rating, put it in the family category." (248) Whole page; In all cases, "movietable" should be changed to "movie_table" (258) Description of "Purchased dates", next-to-last line contains typo. "alwasy" was changed to "always" {275} In the paragraph beginning with the text "Remember our top 100 songs?", the second line was changed from "To see songs 20 through 30..." to "Suppose we wanted to see songs 20 through 29..." (324) Shorthand notations; Removed semicolons after the arrows. For instance, T.x -> ; T.y should be: T.x -> T.y (339) Thought Cloud; "...writing a hundreds of queries" should be "...writing hundreds of queries" (349) 2nd paragraph; The second statement of the second paragraph on p. 349 is technically incorrect or explains incorrectly the usage of the SUBSTR function. To remedy the mistake, we removed "We're telling it to return the same part we just put in interest1, plus two more characters (for the comma and space)." (350) In 'sharpen your pencil', in the hint text; It says 'Rhe' instead of 'The' (355) Middle; Code returns error The 4th line of the big code query was changed from "profession varchar(20)" to mc_prof varchar(20)