
show databases; 查看数据库列表
create database mydb1; 创建数据库
create database mydb2 location 'user/hive/mydb2'; 指定数据库hdfs存储位置


创建表 create table t1(id int,name string);


其中默认的数据库在hdfs中存储的位置
其中数据库表dbs中也可以查看相关数据库在hdfs存储的位置

1、 desc t1; 查看表结构信息
2、 show create table t1;查看表的创建信息

在表columns_v2表中存储hive表的字段信息
alter table t2 rename to t2_bak;修改表名

alter table t2_bak add columns(score string); 增加字段
hive在创建表的时候,需要我们指定相应的行分隔符,默认是是\n,也就是换行符
create table t3_new(
id int comment 'ID',
stu_name string comment 'name',
stu_birthday date comment 'birthday',
online boolean comment 'is online'
)row format delimited
fields terminated by '\t'
lines terminated by '\n'

把数据导入表中
load data local inpath '/data/soft/hivedata/t2.data' into table t3_new;
