| From: | Steve Crawford <scrawford(at)pinpointresearch(dot)com> |
|---|---|
| To: | Mike Christensen <mike(at)kitchenpc(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Best data type to use for sales tax percent |
| Date: | 2009-10-08 22:36:45 |
| Message-ID: | 4ACE697D.6070508@pinpointresearch.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Mike Christensen wrote:
> (Sorry for the super-easy question)
>
> I want to store sales tax (as a percent) in the DB, such as 9.5%.
> What's the best data type for this? I'm guessing numeric(2,3) should
> be fine, yes? I'm not too familiar with the numeric type (I was using
> "real" before), but as I understand the data will be stored using the
> necessary number of bits on the disk? Thanks!
>
> Mike
>
>
Peruse: http://www.postgresql.org/docs/8.4/interactive/datatype-numeric.html
Pay special attention to nuggets like:
The data types real and double precision are inexact...
and
If you require exact storage and calculations (such as for monetary
amounts), use the numeric type instead....
Cheers,
Steve
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Christophe Pettus | 2009-10-08 22:39:47 | Re: Best data type to use for sales tax percent |
| Previous Message | Mike Christensen | 2009-10-08 22:04:35 | Best data type to use for sales tax percent |