创建表
create table flowinfo
(id string,phonenum string,mac string,ip string,url string,num1 string,num2 string,upflow int,downflow int,code string,
datelong string)row format delimited fields terminated by " ";
导入表
load data local inpath “/home/waiwai/log01.data” into table flowinfo;
建表 已存在时不报异常
create database if not exists db_hive;
显示数据库信息
create database if not exists db_hive;
显示数据库详细信息
desc database extended db_hive;
修改数据库
alter database db_hive set dbproperties(‘createtime’=‘20201101’);
删除空的数据库
drop database db_hive;
根据上个查询结果创建表
create table if not exists student2 as select id,name from stu;
根据已经存在的表结构创建表
create table if not exists student3 like student;
查询表的类型
desc formatted stu;
创建外部表
create external table if not exists student4(
id int,
name string,
age int);
把内部表修改为外部表