hive建库
建库语法
创建一个hive的数据库,就会默认创建一个对应的文件夹在这个路径下面
hive.metastore.warehouse.dir
/user/hive/warehouse
create database;
语法
查看数据库信息
查看数据库基本信息
desc database myhive2;
查看数据库更多详细信息
desc database extended myhive2;
hive建表
[(col_name data_type [COMMENT col_comment], ...)] 列注释
[COMMENT table_comment] 表注释
[PARTITIONED BY (col_name data_type [COMMENT col_comment], ...)]
[CLUSTERED BY (col_name, col_name, ...)
[SORTED BY (col_name [ASC|DESC], ...)] INTO num_buckets BUCKETS]
[ROW FORMAT row_format]
[STORED AS file_format]
[LOCATION hdfs_path