1.元数据服务:nohup hive --service metastore &
2.远程服务:nohup hive --service hiveserver2 &
3.创建数据库:create database [if not exist] 库名
4.使用数据库:use 库名
5.查询当前使用的数据库:select current_database()
6.查看数据库详情:desc/describe database 库名;show create database 库名
7.删除数据库:drop database 库名 cascade --(cascade代表强制删除)
8.创建内部表:
create table [if not exists] 表名(
)row format delimited fields terminated by ' ' --- 如何分割符
collection items terminated by ' ' --- 如何分割集合
map keys terminated by ' ' --- 如何分割映射
lines terminated by ' ' ; --- 如何分割行
9.创建外部表:
create external table [if not exists] 表名(
)
10.修改表结构操作:
(1)修改表名:alter table 表名 rename to 新表名
(2)修改列名:alter table 表名 change 列名 新列名 列名属性
(3)添加多列:alter table 表名 add colunms(列名1 列名属性,列名2 列名属性...)
11.加载文件
(1)加载hdfs文件目录数据:load data inpath ' ' into table 表名
(2)加载centors系统目录数据:load data local inpath ' ' into table 表名