码迷,mamicode.com
首页 > 其他好文 > 详细

[Hive_7] Hive 中的 DDL 操作

时间:2019-01-05 19:50:08      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:str   style   int   customers   类型   操作   关键字   数据   col   


0. 说明

 

  DDL(Data Definition Languages)语句:数据定义语言
  这些语句定义了不同的数据段、数据库、表、列、索引等数据库对象的定义。
  常用的语句关键字主要包括 create、drop、alter 等。

 


 

1. alter

# 1.修改表名
    alter table wc rename to wc3;    

# 2.添加列
    alter table customers add columns(wife string);

# 3.删除列,不能用
    alter table customers drop column wife;

# 4.替换所有列,修改字段名
    alter table customers replace columns(id int, name string, age int);

# 5.将id列改名为no,类型为string
     alter table customers change column id no string;

 

 

 

 


 

[Hive_7] Hive 中的 DDL 操作

标签:str   style   int   customers   类型   操作   关键字   数据   col   

原文地址:https://www.cnblogs.com/share23/p/10225513.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!