MYSQL

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • rounding digits after decimal sign

    1 answers - 1007 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Dimitar Vassilev asks:
    Hello,
    Can anyone point me to a section of manual or link how to reduce digits
    after
    a decimal sign?
    I have a table
    mysqldesc part;
    | Field | Type | Null | Key | Default | Extra |
    | kod | varchar(255) | YES | | NULL | |
    | bulstat | double(15,5) | YES | MUL | NULL | |
    | Land | varchar(3) | YES | MUL | NULL | |
    | ID | varchar(15) | YES | MUL | NULL | |
    | IME | varchar(100) | YES | MUL | NULL | |
    | VALUE | double(15,5) | YES | | NULL | |
    | CNT | smallint(5) | YES | | NULL | |
    | Date | datetime | YES | | NULL | |
    and in bulstat column i have digits like 831690750.00000
    which i would like round to the last whole digit.
    Also could someone give a hint how to recode digits in order to anonymize
    data.
    mysql\select round(12.3456789, 3);
    mysql\12.345
    Can you say more about this:
    "Also could someone give a hint how to recode digits in order to anonymize
    data."
    David
  • No.1 | | 663 bytes | |

    2007-01-31 dpgirago (AT) mdanderson (DOT) org wrote:
    Can anyone point me to a section of manual or link how to reduce digits

    Lookup the manual for "round()" but be sure that you understand it if you use
    round in financial applications as it might be unexpected for you:

    mysqlSELECT 25E-1 = 2.5, round(25E-1, 0), round(2.5,0);

    | 25E-1 = 2.5 | round(25E-1, 0) | round(2.5,0) |

    | 1 | 2 | 3 |

    1 row in set (0.00 sec)

    "Also could someone give a hint how to recode digits in order to anonymize
    data."

    Depending on what exactly you want, play around with random() and substring().

    bye,
    -christian-

Re: rounding digits after decimal sign


max 4000 letters.
Your nickname that display:
In order to stop the spam: 3 + 2 =
QUESTION ON "MYSQL"

EMSDN.COM