Jump to content


Photo

Errors in the SQL book


  • Please log in to reply
1 reply to this topic

#1 zaifd

zaifd

    New Member

  • Members
  • Pip
  • 4 posts

Posted 09 December 2008 - 01:32 PM

I have been reading the book and for the most part have to say that it's very informative and very interesting but I did notice some errors along the book that do not seem to make sense when the answers are given to questions that are presented for the user to complete.
Has anyone else noticed this in the book or is it me not understanding the book as well as I thought ?

#2 Doug Houser

Doug Houser

    New Member

  • Members
  • Pip
  • 1 posts

Posted 22 March 2015 - 04:27 PM

Yes, I have noticed a few problems with some topics.  Specifically, Chapter 7 in the Add more interest columns exercise.  I went a different way than the book.

 

Alter Table my_contacts

Add Column interest1 VarChar(20) After status,

Add Column interest2 VarChar(20) After interest1,

Add Column interest3 VarChar(20) After interest2,

Add Column interest4 VarChar(20) After interest3;

Update my_contacts

Set interest1 = SubString_Index(interests, ',', 1);

Update my_contacts

Set interest2 = SubString_Index(SubString_Index(interests, ',', 2), ',', -1);

Update my_contacts

Set interest3 = SubString_Index(SubString_Index(interests, ',', 3), ',', -1);  etc. for the last one, then

Alter Table my_contacts Drop Column interests;

 

This doesn't give the results that the book said it would, nor does the method the book used which was the unnested Substring method.  Apparently, the Substring method is supposed to "cut" the string from the target string, leaving what's left for the next Substring operation.  Look on page 341 and you will see what I am talking about.

 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users