总结一下ODPS数据库常用命令,希望能给使用的小伙伴提供一点帮助~
(1)切换数据库:use [数据库的名称];
(2)查看数据库中的表:list tables;
(3)创建表以及往表中插入数据的过程:
创建表
CREATE TABLE zyn001(id STRING,name STRING,email STRING,tel STRING,phone STRING)PARTITIONED BY (year STRING);
创建分区
ALTER TABLE zyn001 ADD PARTITION(year='2010');
往表中插入数据
insert into table zyn001 partition (year='2010') values ('43112920021208138X','user1','juan24@hotmail.com','68665328','18710205286');
(4)创建的表中的字段存在时间类型,以及往该表中插入数据:
CREATE TABLE zyn005(account STRING,company STRING,nashuiren STRING,SocialCreditc STRING,date01 datetime)PARTITIONED BY (year STRING);
ALTER TABLE zyn005 ADD PARTITION(year='2018');
insert into table zyn005 partition (year='2018') values ('955880920607503181','拼多多网络科技有限公司','568423157684124','Y2522400281173628T',datetime'0017-11-11 00:00:00');
insert into table zyn005 partition (year='2018') values ('404158857426703325','北京三快科技有限公司','500103203035206','Y1542133436735294Y',datetime'2017-11-08 00:00:00');