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上的中小型网站中.由于其体积小.速度快.总体拥有成本低,尤 ...
随机推荐
- datatable刷新表头
使用jQuery的datatable生成表格数据,当需要改变表头时,调用Table.fnDestroy();再重新创建表头 var oTable = null; function initSettin ...
- WinNTSetup v3.8.7 正式版绿色增强版
最强系统安装利器:WinNTSetup 现已更新至 v3.8.7 正式版!这次更新修复调整了诸多问题,新版非常好用接近完美!WinNTSetup 现在已经自带BCDBoot 选项,并且完全支持Wind ...
- Scales小谈gulp
gulp是一个自动化构建工具,开发者可以使用它在项目开发过程中自动执行常见任务. 外网:http://gulpjs.com/ 中文官网:http://www.gulpjs.com.cn/ 易于使用 ...
- 【Codeforces718C】Sasha and Array 线段树 + 矩阵乘法
C. Sasha and Array time limit per test:5 seconds memory limit per test:256 megabytes input:standard ...
- 关于line-height
line-height不允许负值,给定值之后会根据font-size计算行高,line-height指定的行高是行高最小值,设置height可以增大行高 line-height的计算:以px为例,li ...
- 【CityHunter】Unity3D设计AR探索模式
为了增加游戏的乐趣性,我对项目进行了Unity3D的引入,经过一番折腾,终于做出了一个基本的AR探索模式的基本雏形. 途中的小方块就是虚拟物体,因为是静态图片,所以也不能看出什么来,只能文字形容一下: ...
- System类和Random类
System类 成员方法: public static void gc():运行垃圾回收器 public static void exit(int status):退出垃圾回收器 public sta ...
- 在github上搭建hexo博客
准备工作 安装git 系统是win10家庭版,采用git v1.9.5版本,比较简单,一路next直到finsh完成安装. 安装node.js hexo是基于node.js驱动的一款快速.简单且功能强 ...
- ubuntu下安装gedit插件
因为gedit-plugins : 依赖: gir1.2-zeitgeist-2.0 所以首先 sudo apt-get install gir1.2-zeitgeist-2.0 如果报错可以先 su ...
- [Unity] Cg标准函数库