hive建表语句

来源:互联网 发布:计算器java代码详解 编辑:程序博客网 时间:2024/04/28 08:05

Create [EXTERNAL] TABLE [IF NOT EXISTS] table_name[(col_name data_type [COMMENT col_comment], ...)][COMMENTtable_comment][PARTITIONED BY (col_name data_type [COMMENT col_comment], ...)][CLUSTERED BY (col_name,col_name, ...) [SORTED BY (col_name[SCC|DESC], ...)] INTO num_buckets BUCKETS][ROW FORMAT row_format][STORED AS file_format]http://write.blog.csdn.net/postedit/53667150[LOCATION hdfs_path]row format delimited fields terminated by '\t'create table tablename(id String,user map<String,String>course array<String>content struct<father:String,mother:String>)partitioned by(dt string)row format delimitedfields terminated by '\t'                               --字段分隔符collection items terminated by '|'              --数组分隔符 结构体分隔符map keys terminated by ':'                         --map分隔符stored as textfile;加载数据
LOAD DATA[LOCAL] INPATH 'filepath' [OVERWRITE] INTO TABLEtablename [PARTITION(partcol1=val1, partcol2=val2 ...)]
 load data inpath 'baby.txt' into table baby;

0 0
原创粉丝点击