Hive创建表

本文介绍了如何使用Hive创建不同类型的数据表,包括普通表、添加了表分区的表、聚类存储的表以及指定存储路径的外部表。通过示例展示了创建过程,如创建带有字段注释的普通表。
摘要由CSDN通过智能技术生成

1.创建普通表


hive> CREATE TABLE test_table(name STRING,userid INT,ip STRING COMMENT 'ip address of the user')COMMENT 'this is the test table';


hive> show tables;
OK
test_table

Time taken: 0.492 seconds, Fetched: 1 row(s)

hive> describe test_table;

OK
name                    string                                      
userid                  int                                         
ip                      string                  ip address of the user

Time taken: 0.457 seconds, Fetched: 3 row(s)

hive> describe extended test_table;

OK
name                    string                                      
userid                  int                                         
ip                      string                  ip address of the user
         
Detailed Table Information    Table(tableName:test_table, dbName:default, owner:caiyong, createTime:1425990662, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:name, type:string, comment:null), FieldSchema(name:userid, type:int, comment:null), FieldSchema(name:ip, type:string, comment:ip address of the user)], location:hdfs://127.0.0.1:8020/user/hive/warehouse/test_table, inputFormat:org.apache.hadoop.mapred.TextInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat, compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, parameters:{serialization.format=1}), bucketCols:[], sortCols:[], parameters:{}, skewedInfo:SkewedInfo(skewedColNames:[], skewedColValues:[], skewedColValueLocationMaps:{}), storedAsSubDirectories:false), part
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值