hive 普通创建表和跟新列操作
创建表
CREATE TABLE if not exists student (
student_id int,
sex int,
address String,
email String
)
create table student_1(
student_id int,
sex int comment 'sex:0 gg,1 man',
address String comment 'address is student Faily address',
email String
)
partitioned by(ds String,country String)//指定分区,按照地市和时间进行分区,此并没有真正的存储列,也就是此列不存在你的数据中
row format delimited //设置创建表在加载数据的列分割符
fields terminated by '\001'//分割列
stored as sequencefile//需要压缩数据
create table student_2(
student_id int,
sex int comment 'sex:0 gg,1 man',
address String comment 'address is student Faily address',
email String
)
comment 'student_2 table view'
partitioned by(ds String,country String)
clustered by(student_id) sorted by (student_id) into 32 buckets//根据sutdent_id进行分区并存储,并对student_id进行排序并放到32个桶中
row format delimited
fields terminated by '\001'
stored as sequencefile
alert table student_2 to student_3
create table student_2(
student_id int,
sex int comment 'sex:0 gg,1 man',
address String comment 'address is student Faily address',
email String
)
comment 'student_2 table view'
partitioned by(ds String,country String)
clustered by(student_id) sorted by (student_id) into 32 buckets//根据sutdent_id进行分区并存储,并对student_id进行排序并放到32个桶中
row format delimited
fields terminated by '\001'
stored as sequencefile
location '<hdfs路径>' //表数据存在hdfs上目录,也可以是本地目录
alert table tableName add|replace colunms(col_name col_type col_moent,.......)
hive 普通创建表和跟新列操作的更多相关文章
- 向SQL Server 现有表中添加新列并添加描述.
注: sql server 2005 及以上支持. 版本估计是不支持(工作环境2005,2008). 工作需要, 需要向SQL Server 现有表中添加新列并添加描述. 从而有个如下存储过程. (先 ...
- hive中创建表失败
使用create table命令创建表失败,如下错误信息: hive> create table test(id int,name string,age int,sex string); FAI ...
- 在hive执行创建表的命令,遇到异常com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
今天在练习hive的操作时,在创建数据表时,遇到了异常 FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.ex ...
- Oracle入门基础(九)一一创建表和管理表
练习:查询每一年入职人数及总人数 SQL> select count(*) Total, 2 sum(decode(to_char(hiredate,'yyyy'),'1980',1,0)) & ...
- 使用sql语句创建修改SQL Server标识列(即自动增长列)
一.标识列的定义以及特点SQL Server中的标识列又称标识符列,习惯上又叫自增列.该种列具有以下三种特点:1.列的数据类型为不带小数的数值类型2.在进行插入(Insert)操作时,该列的值是由系统 ...
- Hive与HBase表联合使用Join的问题
hive与hbase表结合级联查询的问题,主要hive两个表以上涉及到join操作,就会长时间卡住,查询日志也不报错,也不会出现mr的进度百分比显示,shell显示如下图 如图: 解决这个问题,需要修 ...
- SQL-表的操作(创建表,删除表,更改列,插入新行,更改行的值,删除表中数据)
一,操作表及列 1.创建表: CREATE TABLE test (ID int PRIMARY KEY IDENTITY,Name varchar(20) ) 2.删除表 DROP TABLE t ...
- hive创建表
一.为什么要创建分区表 1.select查询中会扫描整个表内容,会消耗大量时间.由于相当多的时候人们只关心表中的一部分数据, 故建表时引入了分区概念. 2.hive分区表:是指在创建表时指定的part ...
- Mysql下在某一列后即表的某一位置添加新列的sql语句
Mysql简介 MySQL是一个开放源码的小型关联式数据库管理系统,开发者为瑞典MySQL AB公司.MySQL被广泛地应用在Internet上的中小型网站中.由于其体积小.速度快.总体拥有成本低,尤 ...
随机推荐
- Ubuntu 14.04.1 建立 Android M, Android N 開發環境 與 問題
# Modify /etc/apt/sources.list# add below 3 lines to /etc/apt/sources.listdeb http://archive.ubuntu. ...
- 链队列java实现
public class LinkHeap<T> { class Node<T> { T data; Node<T> next; Node(T data) { th ...
- outlook 2016 for windows 每次刷新发送接收邮件会弹出登陆界面
Q: outlook2016 for windows 每次刷新发送接收邮件会弹出登陆界面,office365 ProPlus 都是正常激活了,Word 和Excel都不存在此类问题 A: 排除用户的o ...
- PHP处理海量样本相似度聚类算法
catalogue . TF-IDF . 基于空间向量的余弦算法 . 最长公共子序列 . 最小编辑距离算法 . similar_text . local sensitive hash 局部非敏感哈希 ...
- hosts manager——hosts配置管理工具
引言 做web开发相关的经常会用到hosts修改的功能,各个平台好像都有hosts 配置GUI(据我所知windows有.MAC OX也有),但是命令行配置hosts的好像还没有,命令行配置的话有几个 ...
- Spring-IOC-BeanFactory
BeanFactory BeanFactory 是 Spring 的“心脏”.它就是 Spring IoC 容器的真面目.Spring 使用 BeanFactory 来实例化.配置和管理 Bean.但 ...
- 【Beta】七天屠蛟记
团队名字: 一不小心就火了 屠龙天团少年们: 031402504 陈逸超 (组长) 031402505 陈少铭 031402511 黄家俊 031402515 翁祖航 031402516 黄瑞钰 03 ...
- <!DOCTYPE html>作用
1.定义: DOCTYPE标签是一种标准通用标记语言的文档类型声明,它的目的是要告诉标准通用标记语言解析器,它应该使用什么样的文档类型定义(DTD)来解析文档. <!DOCTYPE> 声明 ...
- JS控制flash的方法
JS控制flash的一些方法:Play() ---------------------------------------- 播放动画 StopPlay()---------------------- ...
- Linux快速体验
目录结构: /:根目录,根目录下一般只存放子目录,不存放文件./bin: 存放可执行的二进制文件,如常用的命令ls. tar.mv. cat等./boot: 存放linux系统启动时需要的一些文件./ ...