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:
>1.34
>300000.00
>3344.92
>
>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.

>
>Thanks
>
>Desmond
>
>>From: "Mike(mickako)Blezien" <[EMAIL PROTECTED]>
>>Reply-To: [EMAIL PROTECTED]
>>To: Desmond Lee <[EMAIL PROTECTED]>
>>CC: [EMAIL PROTECTED]
>>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.
>>--
>>Mike(mickalo)Blezien
>>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>Thunder Rain Internet Publishing
>>Providing Internet Solutions that work!
>>http://www.thunder-rain.com
>>Tel: 1(985)902-8484
>>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to