./sqlline.py localhost:2181
create schema IF NOT EXISTS "test";
第一次创建有可能会报如下错误,需要修改配置文件
Error: ERROR 725 (43M08): Cannot create schema because config phoenix.schema.isNamespaceMappingEnabled for enabling name space mapping isn't enabled. schemaName="test" (state=43M08,code=725)
java.sql.SQLException: ERROR 725 (43M08): Cannot create schema because config phoenix.schema.isNamespaceMappingEnabled for enabling name space mapping isn't enabled. schemaName="test"
修改$HASE_HOME/conf/hbase-site.xml文件和 $PHOENIX_HOME/bin/hbase-site.xml文件,修改完成重启Hbase服务
use "test";
CREATE TABLE IF NOT EXISTS user(id VARCHAR NOT NULL primary key, name VARCHAR,age VARCHAR,date Date);
!tables
!desc user;
upsert into USER (id,name,age,date) values('1','zhangsan','18','2023-7-18');
delete from USER where id = '1';
删除所有
delete from USER;
upsert into USER (id,name,age,date) values('1','zhangsan','18','2023-7-18');
upsert into USER (id,name,age,date) values('2','lisi','20','2023-7-18');
select * from USER;
upsert into USER (id,name,age,date) values('2','lisi2','20','2023-7-18');
select * from USER;
create table test01 (
col1 integer not null primary key,
col2 varchar(2),
col3 varchar(5),
col4 decimal(4,2),
col5 decimal(6,3)
);