Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
17
Task/Currency/DuckDB/currency.duckdb
Normal file
17
Task/Currency/DuckDB/currency.duckdb
Normal 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);
|
||||
Loading…
Add table
Add a link
Reference in a new issue