Results 1 to 3 of 3
Thread: mediumint and decimal question
- 06-07-2010, 09:48 AM #1
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 4
mediumint and decimal question
I use MySQL 5.1 as backend and Netbeans for creating GUI application. In my table I have a field which has a data type of [b]mediumint[b]. When I insert a value at this field (example 25.55) when I view it in MySql it became 26.
What kind of data type should I give?
Thanks in advance,
geje
- 06-07-2010, 11:29 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,448
- Rep Power
- 16
mediumint is an integer.
You are giving it a decimal value, so the db rounds the value (up in this case) to fit it into the field.
If you want to store decimal values then use either DECIMAL or NUMERIC, and give the appropriate scales.
- 06-08-2010, 01:32 AM #3
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 4
Similar Threads
-
Binary to Decimal Converter
By c_walker in forum New To JavaReplies: 15Last Post: 11-24-2009, 02:38 PM -
how to convert decimal value into 8-bit binary value
By tOpach in forum New To JavaReplies: 4Last Post: 10-26-2009, 10:17 PM -
converting a decimal to an int
By shuks in forum New To JavaReplies: 9Last Post: 10-12-2009, 09:41 AM -
Percentage/decimal points?
By Exhonour in forum New To JavaReplies: 6Last Post: 01-16-2009, 10:35 PM -
decimal calculations?
By arnab321 in forum CLDC and MIDPReplies: 5Last Post: 11-19-2008, 03:36 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks