[] : ./sqlline.py node-master2goch:2181[] # 列出metadata信息 : !dbinfo # 创建表 : create table if not exists sinoxx.student(id integer primary key,name varchar(20)); # 当前库存在的表 : !tables // phoenix中的表信息都存在SYSTEM.CATALOG表中,也可以通过下面的sql语句查看系统的表信息 : select * from SYSTEM.CATALOG; // 如果不加双引号, 会自动将小写转为大写 // phoenix表名区分大小写 # 删除表 : drop table sinoxx.alarm; # 查看表结构 !describe "METRIC_AGGREGATE" : select * from sinoxx.alarm_record where alarm_type_id in (40,33) and create_date > TO_TIMESTAMP('2020-03-20 04:44:03') and create_date < TO_TIMESTAMP('2020-03-20 04:45:03') order by create_date desc limit 20;[] : select * from sinoxx.alarm_record where vehicle_id in ('V103346','V102136') and alarm_type_id in (40,33) and create_date > TO_TIMESTAMP('2020-03-20 04:44:03') and create_date < TO_TIMESTAMP('2020-03-20 04:45:03') order by create_date desc limit 20[] # 查询总数 : SELECT count(1) FROM sinoxx.alarm_record select count(1) from sinoxx.alarm_record where vehicle_id in ('V103346','V102136') and alarm_type_id in (40,33) and create_date > TO_TIMESTAMP('2020-03-22 08:00:00') and create_date < TO_TIMESTAMP('2020-03-22 09:00:00') order by row_key : SELECT * FROM sinoxx.alarm_record where vehicle_id in ('V103346','V102136') and alarm_type_id in (40,33) and create_date > TO_TIMESTAMP('2020-03-22 08:00:00') and create_date < TO_TIMESTAMP('2020-03-22 09:00:00') order by create_date LIMIT 5 OFFSET 1; // SELECT * FROM TEST LIMIT pageSize OFFSET startRowNo; : select * from sinoxx.alarm_record where row_key >= ( select max(row_key) from (select row_key from sinoxx.alarm_record where vehicle_id in ('V103346','V102136') and alarm_type_id in (40,33) and create_date > TO_TIMESTAMP('2020-03-22 08:00:00') and create_date < TO_TIMESTAMP('2020-03-22 09:00:00') order by row_key limit 1 ) ) order by row_key limit 5; // select * from t where sqCol>= (select max(sqCol) from (select sqCol from t where ... order by sqCol limit startRowNo)) order by sqCol limit pageSize;