Hive创建表的基本方式
来源:互联网 发布:vmware 8.5 mac破解版 编辑:程序博客网 时间:2024/05/19 07:10
创建表的方式
##方式一 create + load
create [external] table table_name(
col1_name col1_type,
...
coln_name coln_type
)
row format delimited fields terminated by '\t';
//load加载数据
load data [local] inpth '本地文件(linux)/HDFS' [overwrite] into table table_name;
##方式二 like + load
##复制表结构
create table tableB like tableA; //首先必须要有tableA
//load加载数据
laod data [local] inpth '本地文件(linux)/HDFS' [overwrite] into table table_name;
*** ##方式三 as 创建表的同时加载数据
create table tableB row format delimited filelds termianted by ',' as select * from tableA; //首先必须要有tableA
create table emp_as row format delimited fields terminated by ',' as select empno,empname,salary from emp_part1;
##方式四 create + insert
//创建表
create table emp_insert(
id int,
name string,
job string,
salary float
)
row format delimited fields terminated by ',';
//insert into 加载数据
insert into table emp_insert select empno,empname,empjob,salary from emp_part1 where day='20170308' and hour='14';
overwrite/into 二者不能连着写 要么是overwrite 要么是into,推荐用overwrite
##方式一 create + load
create [external] table table_name(
col1_name col1_type,
...
coln_name coln_type
)
row format delimited fields terminated by '\t';
//load加载数据
load data [local] inpth '本地文件(linux)/HDFS' [overwrite] into table table_name;
##方式二 like + load
##复制表结构
create table tableB like tableA; //首先必须要有tableA
//load加载数据
laod data [local] inpth '本地文件(linux)/HDFS' [overwrite] into table table_name;
*** ##方式三 as 创建表的同时加载数据
create table tableB row format delimited filelds termianted by ',' as select * from tableA; //首先必须要有tableA
create table emp_as row format delimited fields terminated by ',' as select empno,empname,salary from emp_part1;
##方式四 create + insert
//创建表
create table emp_insert(
id int,
name string,
job string,
salary float
)
row format delimited fields terminated by ',';
//insert into 加载数据
insert into table emp_insert select empno,empname,empjob,salary from emp_part1 where day='20170308' and hour='14';
overwrite/into 二者不能连着写 要么是overwrite 要么是into,推荐用overwrite
阅读全文
0 0
- Hive创建表的基本方式
- hive 创建表的三种方式
- Hive创建表的几种方式
- hive与hbase关联表的创建,外表方式
- hive表的创建
- HIVE的安装配置、mysql的安装、hive创建表、创建分区、修改表等内容、hive beeline使用、HIVE的四种数据导入方式、使用Java代码执行hive的sql命令
- HIVE的安装配置、mysql的安装、hive创建表、创建分区、修改表等内容、hive beeline使用、HIVE的四种数据导入方式、使用Java代码执行hive的sql命令
- Hive学习(一)-表及数据库的创建删除基本操作
- [总结]----Hive创建表格的几种方式
- hive的表的基本操作
- hive学习笔记——Hive表的创建
- Hive入门--6.表的基本操作
- Hive数据库及表的基本操作
- hive的基本配置
- hive的基本命令
- hive的基本操作
- Hive的基本操作
- Hive的基本操作
- poj 1062 昂贵的聘礼
- 活动选择问题
- Python标准库-------
- 2017 Multi-University Training Contest
- 区间选点问题(找点)
- Hive创建表的基本方式
- awk的基本使用和调用方式
- html元素 css样式 选择器
- 人脸数据集
- ClassPathXmlApplicationContext找不到资源文件
- 利用ODL创建VxLAN网络
- 莫比乌斯反演
- 深入理解css中position属性及z-index属性
- AppBarLayout使用详解