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 delimited
fields 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;