Data update

This commit is contained in:
Ingy döt Net 2025-08-11 18:05:26 -07:00
parent 4d5544505c
commit 4924dd0264
3073 changed files with 55820 additions and 4408 deletions

View file

@ -0,0 +1,17 @@
# Compute the required details in a table using DECIMAL(38,2) for dollars and cents.
create or replace function bill( quantities, prices, taxrate) as table (
with cte as (select sum(q*p) as subtotal
from (select unnest(quantities) as q, unnest(prices) as p)),
details as (select subtotal, subtotal * taxrate as tax,
(subtotal + tax ) as total
from cte)
select subtotal::DECIMAL(38,2) as subtotal,
tax::DECIMAL(38,2) as tax,
total::DECIMAL(38,2) as total
from details
) ;
# The order and tax rate:
from bill ( [4000000000000000, 2],
[5.50, 2.86],
0.0765);