栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 其他

hive-sql DDL常用语句

其他 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

hive-sql DDL常用语句

建表:

create table if not exists xx;

删表:

drop table if exists xx;

删除一列:

alter table xx drop 列名;

清空表:

truncate table xx

添加表字段:

alter table xx add columns(xx  string comment '店铺ID');

修改表字段顺序:

alter table xx change   字段名(需要修改的字段) 字段名 需要修改的字段)字段类型 after 字段名(具体在哪个字段之后)

alter table xx   A  A string after B; 

修改字段备注:

alter table xx change A  A string  comment '金额';

删除分区:

alter table xx drop  partition (time='xx',date='xx',channel=' xx');

导入数据:

load data local inpath '/xx/xx.csv' overwrite into table xx;

插入数据:

insert overwrite xx partition (time,date,channel)

insert into xx partition (time,date,channel)

创建视图:

create or replace temporary view 视图名 as select ...

create or replace temporary view 视图名(

字段名 字段类型,

AA  string...)

USING org.apache.spark.sql.execution.datasources.csv.CSVFileFormat

OPTIONS(

PATH 'XX/XX',

header 'true',

delimiter '01',

quote '"'

);

持续更新中。。。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/279253.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号