Derby 是否支持日期的 INTERVAL
Does Derby support INTERVAL for date
我正在 Apache Derby (10.14.2) 上进行性能测试。我正在使用 TPCH 基准测试。我已经完成了 TPCH 的 dbgen 部分并填充了数据库。 TPCH 基准测试查询中有 22 个查询。我无法转换第一个查询以适应 Apache Derby 的语法。在 make 文件中,我将 DB 指定为 DB2。因为那里没有 Apache Derby 选项。
查询如下:
select
l_returnflag,
l_linestatus,
sum(l_quantity) as sum_qty,
sum(l_extendedprice) as sum_base_price,
sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
avg(l_quantity) as avg_qty,
avg(l_extendedprice) as avg_price,
avg(l_discount) as avg_disc,
count(*) as count_order
from
lineitem
where
l_shipdate <= '1998-12-01' - interval ':1' day (3)
group by
l_returnflag,
l_linestatus
order by
l_returnflag,
l_linestatus;
ij 工具出错:
ERROR 42X01: Syntax error: Encountered "\':1\'" at line 15, column 47.
Issue the 'help' command for general information on IJ command syntax.
Any unrecognized commands are treated as potential SQL commands and executed directly.
Consult your DBMS server reference documentation for details of the SQL syntax supported by your server.
有没有办法在 TPCH 中为 Apache Derby 生成查询。或者可以将查询隐藏到 Apache Derby 的工具。
提前致谢。
您可以试试TIMESTAMPADD()
函数:
WHERE l_shipdate <= CAST({fn TIMESTAMPADD(SQL_TSI_DAY, -1, CAST('1998-12-01 00:00:00' AS TIMESTAMP))} AS DATE)
我正在 Apache Derby (10.14.2) 上进行性能测试。我正在使用 TPCH 基准测试。我已经完成了 TPCH 的 dbgen 部分并填充了数据库。 TPCH 基准测试查询中有 22 个查询。我无法转换第一个查询以适应 Apache Derby 的语法。在 make 文件中,我将 DB 指定为 DB2。因为那里没有 Apache Derby 选项。
查询如下:
select
l_returnflag,
l_linestatus,
sum(l_quantity) as sum_qty,
sum(l_extendedprice) as sum_base_price,
sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
avg(l_quantity) as avg_qty,
avg(l_extendedprice) as avg_price,
avg(l_discount) as avg_disc,
count(*) as count_order
from
lineitem
where
l_shipdate <= '1998-12-01' - interval ':1' day (3)
group by
l_returnflag,
l_linestatus
order by
l_returnflag,
l_linestatus;
ij 工具出错:
ERROR 42X01: Syntax error: Encountered "\':1\'" at line 15, column 47.
Issue the 'help' command for general information on IJ command syntax.
Any unrecognized commands are treated as potential SQL commands and executed directly.
Consult your DBMS server reference documentation for details of the SQL syntax supported by your server.
有没有办法在 TPCH 中为 Apache Derby 生成查询。或者可以将查询隐藏到 Apache Derby 的工具。
提前致谢。
您可以试试TIMESTAMPADD()
函数:
WHERE l_shipdate <= CAST({fn TIMESTAMPADD(SQL_TSI_DAY, -1, CAST('1998-12-01 00:00:00' AS TIMESTAMP))} AS DATE)