Hive SQL语句使用记录

清空表

truncate table table_name;

Hive导入csv

load data local inpath '/home/parallels/hw.csv' into table table_name;

作者在导入csv文件后发现数据全是NULL,经过一番搜索发现是分隔符不一致。csv文件的分隔符是','号,hive在创建的时候并未设置分隔符,从而导致出错。

更改分隔符,执行下面代码:

alter table table_name set serdeproperties('field.delim'=',');

显示建表语句

show create table table_name;

删除一行数据

insert overwrite table table_name select * from table_name where created_at != 'created_at';

更改列的顺序

alter table dev.dev_test20190225 change c11 c11 int after c1;
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容