impala基础
impala:
查询impala表时一定要加库名
使用级联删除带有表的数据库:DROP database name cascade;
insert插入的两种方式:
1. insert into employee (ID,NAME,AGE,ADDRESS,SALARY)VALUES (1, 'Ramesh', 32, 'Ahmedabad', 20000 );
2.不指定列值,注意顺序
insert into employee values (2, 'Khilan', 25,'Delhi', 15000 );
overwrite覆盖Insert overwrite employee values (1, 'Ram', 26, 'Vish', 370);
desc customer;获取表的字段和类型
alter
1.重命名:ALTER TABLE oldname RENAME TO newname;
2.向表中添加列:ALTER TABLE users ADD COLUMNS (account BIGINT, phone BIGINT);
3.从表中删除列:ALTER TABLE users DROP account
4.改变表中的列名以及列的类型:
ALTER TABLE name CHANGE column_name new_name new_type
清除表中的数据:truncate table_name;
视图与表的区别:
1.视图(view)是在基本表之上建立的表,它的结构(即所定义的列)和
内容(即所有数据行)都来自基本表,它依据基本表存在而存在。
2.一个视图可以对应一个基本表,也可以对应多个基本表,基于一个表也可以建立多个视图。
视图是基本表的抽象和在逻辑意义上建立的新关系。
3.表可以建立各种触发器,可以建立索引,可以建立主健、约束等。但是视图不能建立这些
对象(视图可以建立替代触发器)。表和视图可以更新,但是视图的更新受到约束。
排序:Select * from customers ORDER BY id asc;
asc升序,desc降序
分组聚合:Select name, sum(salary) from customers Group BY name;
过滤:select max(salary) from customers group by age having max(salary) > 20000;
限制输出结果:select * from customers order by id limit 4
偏移量,跳过几行的意思:从头开始算select * from customers order by id limit 4 offset 0;
union:合并查到的结果
select * from customers order by id limit 3 union select * from employee order by id limit 3;
给复杂的查询部分定义别名:
with x as (select 1), y as (select 2) (select * from x union y);
去重:select distinct columns… from table_name;
hive与impala不同步:refresh或者invalid metaData+表名
impala基础的更多相关文章
- 第二章 impala基础使用
第二章 impala基本使用 1.impala的使用 1.1.impala-shell语法 1.1.1.impala-shell的外部命令参数语法 不需要进入到impala-shell交互命令行当中即 ...
- Impala基础认知与安装
一.Impala简介 Cloudera Impala对你存储在Apache Hadoop在HDFS,HBase的数据提供直接查询互动的SQL.除了像Hive使用相同的统一存储平台,Impala也使用相 ...
- Impala 学习
Impala 基础知识介绍与学习,参考文章: Impala-大数据时代快速SQL引擎 https://blog.csdn.net/kangkangwanwan/article/details/7865 ...
- 【Hadoop离线基础总结】impala简单介绍及安装部署
目录 impala的简单介绍 概述 优点 缺点 impala和Hive的关系 impala如何和CDH一起工作 impala的架构及查询计划 impala/hive/spark 对比 impala的安 ...
- 【原创】大数据基础之Impala(3)部分调优
1)将coordinator和executor角色分离 By default, each host in the cluster that runs the impalad daemon can ac ...
- 【原创】大数据基础之Impala(1)简介、安装、使用
impala2.12 官方:http://impala.apache.org/ 一 简介 Apache Impala is the open source, native analytic datab ...
- 【原创】大数据基础之Impala(2)实现细节
一 架构 Impala is a massively-parallel query execution engine, which runs on hundreds of machines in ex ...
- 【原创】大数据基础之Ambari(4)通过Ambari部署Impala
ambari2.7.3(hdp3.1) 安装 impala2.12(自动安装最新) ambari的hdp中原生不支持impala安装,下面介绍如何通过mpack方式使ambari支持impala安装: ...
- 【原创】大数据基础之Kerberos(2)hive impala hdfs访问
1 hive # kadmin.local -q 'ktadd -k /tmp/hive3.keytab -norandkey hive/server03@TEST.COM'# kinit -kt / ...
随机推荐
- jquery入门知识点总结(转)
一.jquery的加载方法 $(document).ready(function(){js代码}); $(function(){js代码});(一般使用这个); 注意点1:使用jquery必须先导入函 ...
- LeetCode 628. Maximum Product of Three Numbers (最大三数乘积)
Given an integer array, find three numbers whose product is maximum and output the maximum product. ...
- LeetCode 617. Merge Two Binary Tree (合并两个二叉树)
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of t ...
- Linux系列教程(七)——Linux帮助和用户管理命令
上篇博客我们介绍了Linux文件搜索命令,其中find是用的最多的也是功能最强大的文件或目录搜索命令,和另一个搜索命令locate的区别是,find命令是全盘搜索,刚创建的文件也能搜索的到,而loca ...
- 2_ROS学习
2_VNC远程连接树莓派 在上一次,我们成功的给树莓派安装了Ubuntu mate的操作系统. 树莓派是嵌入式计算机,一般是没有显示屏来显示的,我们通过远程连接来访问树莓派.网上推荐了ssh连接,xr ...
- Eclipse+Spring+SpringMVC+Maven+Mybatis+MySQL+Tomcat项目搭建
---恢复内容开始--- 1. 建表语句及插入数据 CREATE TABLE `book_user` ( user_id INT(11) NOT NULL AUTO_INCREMENT, user_n ...
- 读《你不知道的JavaScript(上卷)》后感-作用域闭包(二)
github原文 一. 序言 最近我在读一本书:<你不知道的JavaScript>,这书分为上中卷,内容非常丰富,认真细读,能学到非常多JavaScript的知识点,希望广大的前端同胞们, ...
- python 3 ---购物车练习
# -*- coding:utf-8 -*-#Author Chen #定义商品列表List_of_commodities = [ ('Iphone',6888), ('Mac Pro',12888) ...
- webmagic学习-使用注解编写爬虫
写在前面: 官方文档:http://webmagic.io/docs/zh/posts/ch5-annotation/README.html WebMagic支持使用独有的注解风格编写一个爬虫,引入w ...
- ASP.NET没有魔法——ASP.NET MVC 过滤器(Filter)
上一篇文章介绍了使用Authorize特性实现了ASP.NET MVC中针对Controller或者Action的授权功能,实际上这个特性是MVC功能的一部分,被称为过滤器(Filter),它是一种面 ...