• Post Reply Bookmark Topic Watch Topic
  • New Topic

Mistake: OCP Java SE 8 Programmer II Study Guide (Sybex)  RSS feed

 
Hleb Bandarenka
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 10. Page 509
I found that when is created the SPECIES table we use

this is equivalent to DECIMAL(5,0), so we save only Integers
Consequently when we execute

we save only 7 in the column

To save number 7.5 we at least need use DECIMAL(1,1) when create the table
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37399
531
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hleb,
You're right! I never tried to use the number of acres so hadn't noticed that. Thanks for pointing it out!

I've updated this on our online version of how to load the database.

ps - welcome to CodeRanch!
 
Joel Fuhrmann
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To post a 2-digit decimal number, including one left-of-decimal and one right-of-decimal, you would need to say DECIMAL(2,1), denoting 2 total digits and 1 digit after the decimal point.

Joel Fuhrmann
 
Hleb Bandarenka
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You absolutely right
Now (with DECIMAL(1,1)) we can save only 0.0
But with DECIMAL(2,1) - we can save value from -9.9 to 9.9
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37399
531
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hleb,
Well it could be a very small zoo . But you are right that DECIMAL(4,1) is probably more appropriate.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!