PHoenix常用命令
一 、登录命令./sqlline.py localhost:2181:/hbase-unsecure二 、退出命令!quit!exit三 、帮助命令help四 、创建表create table if not exists ljc.student(id integer primary key,name varchar(20));**注意:**如果不加双引号,会自动将小写转为大写phoenix表名区分
·
一 、登录命令
./sqlline.py localhost:2181:/hbase-unsecure
二 、退出命令
!quit
!exit
三 、帮助命令
help
四 、创建表
create table if not exists ljc.student(id integer primary key,name varchar(20));
**注意:**
如果不加双引号,会自动将小写转为大写
phoenix表名区分大小写
五 、查看当前库中存在的表
!tables
六 、删除表
drop table ljc.student;
七 、查看表结构
!describe “METRIC_AGGREGATE”
**注意:** phoenix/hbase对表名、字段名都是大小写敏感,如果直接写小写字母,不加双引号,则默认会被转换成大写字母
八 、插入、更新
Phoenix中不存在update的语法关键字,而是upsert ,功能上替代了Insert+update
upsert into ljc.student(id,name) values(1,'zhangsan');
upsert into ljc.student(id,name) values(2,'lisi');
upsert into ljc.student(id,name) values(3,'wangwu');
upsert into ljc.student(id,name) values(4,'liuping');
upsert into ljc.student(id,name) values(5,'zhouhong');
更多推荐
已为社区贡献1条内容
所有评论(0)