Re: Best data type to use for sales tax percent

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Best data type to use for sales tax percent
Date: 2009-10-10 10:20:40
Message-ID: hapn5o$unr$2@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2009-10-08, Mike Christensen <mike(at)kitchenpc(dot)com> 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?

real, or numeric, probably numeric.

> I'm guessing numeric(2,3) should be fine, yes?

depends on the range of values you want to store.

generally percentages are most usefully represented as decimal fractions
especially if you intend to do arithmetic with them.

numeric reccomended useful for financial stuff.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jasen Betts 2009-10-10 10:33:49 Re: Best data type to use for sales tax percent
Previous Message Jasen Betts 2009-10-10 10:12:00 Re: automated row deletion