> For general-purpose sales-tax...in the United States...for the time being.
>
> I believe the current tax on new vehicles in Israel is 70+% and seem to
> recall that it was well over 100% at one time. Sales taxes already vary by
> product (in California, food is 0% for example) as well as state, c
Christophe Pettus wrote:
On Oct 10, 2009, at 3:33 AM, Jasen Betts wrote:
CREATE DOMAN sales_tax_rate AS DECIMAL CHECK (VALUE >= 0 AND VALUE
<=1);
why the latter check ( VALUE <=1 )?
Since this version has no scale on the DECIMAL, the second check keeps
it from being larger than 1.0, since
On Oct 10, 2009, at 3:33 AM, Jasen Betts wrote:
CREATE DOMAN sales_tax_rate AS DECIMAL CHECK (VALUE >= 0 AND VALUE
<=1);
why the latter check ( VALUE <=1 )?
Since this version has no scale on the DECIMAL, the second check keeps
it from being larger than 1.0, since it's presumably a percen
Jasen Betts wrote:
On 2009-10-09, Peter Eisentraut wrote:
On Fri, 2009-10-09 at 11:46 -0700, Christophe Pettus wrote:
Domains are basically type aliases with an optional CHECK clause, so
you could do something like:
CREATE DOMAN sales_tax_rate AS DECIMAL(5,5) CHECK (VALUE >= 0);
Th
On 2009-10-09, Peter Eisentraut wrote:
> On Fri, 2009-10-09 at 11:46 -0700, Christophe Pettus wrote:
>> Domains are basically type aliases with an optional CHECK clause, so
>> you could do something like:
>>
>> CREATE DOMAN sales_tax_rate AS DECIMAL(5,5) CHECK (VALUE >= 0);
>>
>> Then, yo
On 2009-10-08, 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?
real, or numeric, probably numeric.
> I'm guessing numeric(2,3) should be fine, yes?
depends on the range of
On Oct 9, 2009, at 12:14 PM, Mike Christensen wrote:
I will definitely create a domain for this (and probably for some
other types in my app since I now know about this). However, is the
CHECK really necessary? A numeric(5,5) already has a maximum value of
10^0, so it would already create an o
On Fri, 2009-10-09 at 11:46 -0700, Christophe Pettus wrote:
> Domains are basically type aliases with an optional CHECK clause, so
> you could do something like:
>
> CREATE DOMAN sales_tax_rate AS DECIMAL(5,5) CHECK (VALUE >= 0);
>
> Then, you can use the type "sales_tax_rate" in your tab
Thanks for the info! I was thinking this would be a short thread but
I definitely appreciate all the information.
I will definitely create a domain for this (and probably for some
other types in my app since I now know about this). However, is the
CHECK really necessary? A numeric(5,5) already
On Oct 9, 2009, at 11:36 AM, Mike Christensen wrote:
Can you explain what you mean by "put it in a domain" - I'd love extra
style points, but this sounds like a feature I haven't learned about
yet.
http://www.postgresql.org/docs/8.4/interactive/sql-createdomain.html
Domains are basi
Can you explain what you mean by "put it in a domain" - I'd love extra
style points, but this sounds like a feature I haven't learned about
yet.
On Fri, Oct 9, 2009 at 3:38 AM, Peter Eisentraut wrote:
> On Fri, 2009-10-09 at 00:10 -0700, Mike Christensen wrote:
>> Wouldn't (4,3) let me store 0.00
So back to my question about representing sales tax, it looks like I
have two choices:
1) Use a numeric(5,5) column. This has the advantage of storing the
sales tax in the exact representation of a percent (I can directly
multiply it against any subtotal to get the sales tax). It also
"looks" ni
On Thu, 8 Oct 2009, Lew wrote:
That will fail for the scenario that Christope Pettus pointed out.
California is not the only state with sales tax specified to a quarter
point., or even a tenth of a point as in Missouri, where a local sales tax
can be 9.241%, and equal or exceed 10%, as in Alabam
On Fri, Oct 09, 2009 at 12:10:41AM -0700, Mike Christensen wrote:
> Wouldn't (4,3) let me store 0.000 through 9.999? Maybe I'm still not
> following what both numbers mean.
I think Rich was getting confused about how you wanted to represent your
percentages.
> I understand the point about states
On Fri, 2009-10-09 at 00:10 -0700, Mike Christensen wrote:
> Wouldn't (4,3) let me store 0.000 through 9.999? Maybe I'm still not
> following what both numbers mean.
Yes. If you want 0.000 through 0.999, use numeric(3,3). Adding a check
constraint might increase clarity. And put it in a domain
Wouldn't (4,3) let me store 0.000 through 9.999? Maybe I'm still not
following what both numbers mean.
I understand the point about states/counties with 3 decimal digits of
sales tax, so I'd probably want to do (5,5) which should give me
0.0 - 0.9, and store 9.825% sales tax as .09825. I
Rich Shepard wrote:
On Thu, 8 Oct 2009, Mike Christensen wrote:
I'll probably just use 3,3 and store this value between 0 and 1, since
all
I'll be doing with this number is using it to multiply against a
subtotal. 3,3 gives me 0.000 through 0.999, correct?
Mike,
No. The two digits represe
On Thu, 8 Oct 2009, Mike Christensen wrote:
I'll probably just use 3,3 and store this value between 0 and 1, since all
I'll be doing with this number is using it to multiply against a subtotal.
3,3 gives me 0.000 through 0.999, correct?
Mike,
No. The two digits represent the width of the c
Oops sorry I was thinking 2,3 meant 2 significant digits to the left
of the decimal point and 3 to the right. I just re-read the docs and
now see what you mean. 6,3 would work fine though is maybe a bit
overkill since a 100% sales tax rate would cause a violent revolution
and lead to beheadings,
On Thu, Oct 8, 2009 at 6:04 PM, 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
On Oct 8, 2009, at 3:04 PM, Mike Christensen wrote:
I'm guessing numeric(2,3) should
be fine, yes?
Numeric is definitely what you want. You probably want at least four
fractional digits, since sales tax (at least in California) is
routinely set to a quarter of a point. For example, the b
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 unde
(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 st
23 matches
Mail list logo