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上的中小型网站中.由于其体积小.速度快.总体拥有成本低,尤 ...
随机推荐
- K - 迷宫问题
/*定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, ...
- 美化radio和checkbox样式
HTML部分 <div id="holder"> <div> <div class="tag">Checkbox Small ...
- js-JavaScript高级程序设计学习笔记21 改善JavaScript性能的方法
第24章 最佳实践 1.性能 1.避免全局查找 将在一个函数中会用到多次的全局对象保存在局部变量.比如多次使用document.getElement...,可以首先var doc=document,把 ...
- Photon服务器进阶&一个新游戏的出产(三)
下面或许该介绍介绍我用Photon写的一个4人联机麻将了~ 上图
- IE8的parseInt
踩到一个IE8的parseInt的坑: Chrome:
- C#------连接SQLServer和MySQL字符串
<connectionStrings> <add name="ConnectionStrings" connectionString="Data Sou ...
- ssh模仿ansible批量执行命令的功能
#!/bin/bash ssh_hosts=("IP" "IP1".......) user=root remote_cmd="df -h" ...
- Django基础,Day9 - 静态文件目录与路径设置说明(eg. images, JavaScript, CSS)
静态文件路径设置官方说明 1. Make sure that django.contrib.staticfiles is included in your INSTALLED_APPS. 2. In ...
- [Fluent NHibernate]一对多关系处理
目录 写在前面 系列文章 一对多关系 总结 写在前面 上篇文章简单介绍了,Fluent Nhibernate使用代码的方式生成Nhibernate的配置文件,以及如何生成持久化类的映射文件.通过上篇的 ...
- MRDS学习一——Hello World
第一步:从左边的Basic Activities中把Data这个元件拖到Diagram中,把Data的类别改为string,中间填入Hello World. 第二步:接着把这个资料输出到一个Servi ...