1. []
    2. : ./sqlline.py node-master2goch:2181
    3. []
    4. # 列出metadata信息
    5. : !dbinfo
    6. # 创建表
    7. : create table if not exists sinoxx.student(id integer primary key,name varchar(20));
    8. # 当前库存在的表
    9. : !tables
    10. // phoenix中的表信息都存在SYSTEM.CATALOG表中,也可以通过下面的sql语句查看系统的表信息
    11. : select * from SYSTEM.CATALOG;
    12. // 如果不加双引号, 会自动将小写转为大写
    13. // phoenix表名区分大小写
    14. # 删除表
    15. : drop table sinoxx.alarm;
    16. # 查看表结构
    17. !describe "METRIC_AGGREGATE"
    18. : 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;
    19. []
    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
    21. []
    22. # 查询总数
    23. : SELECT count(1) FROM sinoxx.alarm_record
    24. select count(1) from sinoxx.alarm_record
    25. where vehicle_id in ('V103346','V102136')
    26. and alarm_type_id in (40,33)
    27. and create_date > TO_TIMESTAMP('2020-03-22 08:00:00')
    28. and create_date < TO_TIMESTAMP('2020-03-22 09:00:00')
    29. order by row_key
    30. : SELECT * FROM sinoxx.alarm_record
    31. where vehicle_id in ('V103346','V102136')
    32. and alarm_type_id in (40,33)
    33. and create_date > TO_TIMESTAMP('2020-03-22 08:00:00')
    34. and create_date < TO_TIMESTAMP('2020-03-22 09:00:00')
    35. order by create_date
    36. LIMIT 5 OFFSET 1;
    37. // SELECT * FROM TEST LIMIT pageSize OFFSET startRowNo;
    38. : select * from sinoxx.alarm_record
    39. where row_key >=
    40. ( select max(row_key) from
    41. (select row_key from sinoxx.alarm_record
    42. where vehicle_id in ('V103346','V102136')
    43. and alarm_type_id in (40,33)
    44. and create_date > TO_TIMESTAMP('2020-03-22 08:00:00')
    45. and create_date < TO_TIMESTAMP('2020-03-22 09:00:00')
    46. order by row_key limit 1
    47. )
    48. ) order by row_key limit 5;
    49. //
    50. select * from t where sqCol>=
    51. (select max(sqCol) from
    52. (select sqCol from t where ... order by sqCol limit startRowNo))
    53. order by sqCol limit pageSize;