List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 30 2002 6:33pm
Subject:Re: currency type
View as plain text  
At 10:57 -0700 7/30/02, Desmond Lee wrote:
>Hi Mike
>Thanks for your reply
>Just to check the decimal(6, 2) means show 6 digits to the 2 
>decimals of percision. Thus you get a numbers like:
>Is that correct?

That is not correct.  DECIMAL(6,2) means 6 digits *total*, of which two
are to the right of the decimal point.  This means that 1.34 and 3344.92
are okay, but 300000.00 is not.

>  Why do you not use a float and a decmial type?

DECIMAL gives you perfect accuracy to the number of decimals specified,
with no roundoff error, for one thing.  That's why it's good for monetary
calculations.  On the other hand, it's stored internally as a character
string, so DECIMAL operations are not as fast as operations with native
floating-point types.

>>From: "Mike(mickako)Blezien" <mickalo@stripped>
>>Reply-To: mickalo@stripped
>>To: Desmond Lee <desmond60@stripped>
>>CC: mysql@stripped
>>Subject: Re: currency type
>>Date: Tue, 30 Jul 2002 11:36:30 -0500
>>>>Desmond Lee wrote:
>>>  Hi there
>>>  Does mysql have a currency type, or is it best to just use a varchar or a
>>>  float?
>>>  Thanks
>>>  Desmond
>>I normally use the DECIMAL(6,2) data type, works very for currency values.
>>Thunder Rain Internet Publishing
>>Providing Internet Solutions that work!
>>Tel: 1(985)902-8484

currency typeDesmond Lee30 Jul
  • Re: currency typeMike(mickako)Blezien30 Jul
  • Re: currency typeHarald Fuchs31 Jul
Re: currency typeDesmond Lee30 Jul
  • Re: currency typePaul DuBois30 Jul