Results 1 to 3 of 3
  1. #1
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    5

    Default 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

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    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.

  3. #3
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    5

Similar Threads

  1. Binary to Decimal Converter
    By c_walker in forum New To Java
    Replies: 15
    Last Post: 11-24-2009, 03:38 PM
  2. Replies: 4
    Last Post: 10-26-2009, 11:17 PM
  3. converting a decimal to an int
    By shuks in forum New To Java
    Replies: 9
    Last Post: 10-12-2009, 10:41 AM
  4. Percentage/decimal points?
    By Exhonour in forum New To Java
    Replies: 6
    Last Post: 01-16-2009, 11:35 PM
  5. decimal calculations?
    By arnab321 in forum CLDC and MIDP
    Replies: 5
    Last Post: 11-19-2008, 04:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •