1.随机取样函数(类似oracle sample)
2.关于case when
2.1 是否不支持case when exists(需求如下)
select case when exists (select count() from lineorder where lo_orderkey=‘81869031’) then ‘with tmpstock as( select lo_orderkey
, lo_linenumber
, lo_custkey
, lo_partkey
, lo_suppkey
, lo_orderdate
, lo_orderpriority
, lo_shippriority
, lo_quantity
, lo_extendedprice
, lo_ordtotalprice
, lo_discount
, lo_revenue
, lo_supplycost
, lo_tax
, lo_commitdate
, lo_shipmode
from lineorder’ end aa from dummy;
2.2 case when then后内容无法全部显示
select case when (select count() from lineorder where lo_orderkey=‘81869031’) then ‘with tmpstock as( select lo_orderkey
, lo_linenumber
, lo_custkey
, lo_partkey
, lo_suppkey
, lo_orderdate
, lo_orderpriority
, lo_shippriority
, lo_quantity
, lo_extendedprice
, lo_ordtotalprice
, lo_discount
, lo_revenue
, lo_supplycost
, lo_tax
, lo_commitdate
, lo_shipmode
from lineorder’ end aa from dummy;
–显示内容如下
with tmpstock as( se
附:
dummy建表
CREATE TABLE IF NOT EXISTS dummy
(
dummy
int(11) NOT NULL COMMENT “”
) ENGINE=OLAP
DUPLICATE KEY(dummy
)
COMMENT “OLAP”
DISTRIBUTED BY HASH(dummy
) BUCKETS 12
PROPERTIES (
“replication_num” = “3”,
“colocate_with” = “groupa2”,
“in_memory” = “false”,
“storage_format” = “DEFAULT”
);
insert into dummy(dummy) values(1);
3.在starrocks希望建以varchar类型字段为键值的表需要如何操作
指定ENGINE=OLAP、DISTRIBUTED BY HASH后建表提示“[Err] 1064 - Colocate tables distribution columns must have the same data type: dummy should be INT”