Re: rounding digits after decimal sign
On 2007-01-31 [EMAIL PROTECTED] 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: mysql SELECT 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- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: rounding digits after decimal sign
Hi, If you want to round your value to the specified no. of digits, use round(). Else if you want to extract the values without rounding use truncate(). mysql select round(blustat,2) from parts; [the value will get rounded to the nearest decimal] or mysql select truncate (blustat,2) from parts; [no rounding, simply extract only the value of specified digits] For More info:http://www.keithjbrown.co.uk/vworks/mysql/mysql_p9.php Thanks, ViSolve DB Team - Original Message - From: Dimitar Vasilev [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Thursday, February 01, 2007 1:40 AM Subject: rounding digits after decimal sign Hello, Can anyone point me to a section of manual or link how to reduce digits after a decimal sign? I have a table mysql desc 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.0 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. My end goal is to export the dataset into a social network software for my thesis. Thanks, -- Димитър Василев Dimitar Vassilev GnuPG key ID: 0x4B8DB525 Keyserver: pgp.mit.edu Key fingerprint: D88A 3B92 DED5 917E 341E D62F 8C51 5FC4 4B8D B525 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: rounding digits after decimal sign
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 mysql desc 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.0 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