HiveQL:数据定义
来源:互联网 发布:淘宝新店引流量 编辑:程序博客网 时间:2024/05/17 15:38
一.数据库部分
1.创建数据库:
create database dw; 或者create database if not exists dw;create database dw comment "this is a test database";create database dw location 'my/prefered/location/';create database dw with dbproperties ('creator'='linda','date'='2016-12-10')
备注:在所有数据库相关的命令中,都可以用SCHEMA这个关键字来代替关键字TABLE
2.显示创建的数据库:
show databases; show databases like ‘h.*’
3.描述数据库:
describe database dw; describe database
extended dw;
4.如果想在使用数据库的过程中显示使用的是哪个数据库,可以进行如下设置:
set hive.cli.print.current.db=true;
5.删除数据库:drop database if exists dw;
默认情况下:如果数据库中有表,是不能删除数据库的,这时如果非要删除可以这样:
drop database if exists dw CASDADE;
6.修改数据库:
alter database dw set dbproperties(‘edit_name’=’linda1’)
二.数据表部分
1.创建表部分:
create table if not exists dw.table_1(name string comment '1',salary float comment '2',subordinates array<string> comment '3',deductions map<string,float> comment '4',address struct<street:string,city:string,state:string,zip:int>comment '5')comment 'describe table table_1'tblproperties ('createor'='linda','created_at'='2016-12-10')location '/user/hive/warehouse/dw/table_1';create table if not exists dw.table_2 like dw.table_1;
2.展示报表
show tables;
show tables in dw_2;(在dw中看dw_2中的报表)
show tables ‘abc.*’;
3.描述报表:
describe extended table dw.table
describe formatted table dw.table
4.描述字段:
describe dw.table.name;
0 0
- HiveQL数据定义
- HiveQL:数据定义
- HiveQL数据定义
- HiveQL:数据定义
- HiveQL:数据定义
- hiveQL数据定义
- Hive--HiveQL:数据定义、数据操作
- HiveQL:对数据定义的学习
- Hive编程(四)【HiveQL:数据定义】
- HiveQL:数据操作
- HiveQL:数据操作
- HiveQL:数据操作
- hiveQL
- HiveQL 数据定义语言使用(一)—Hive中数据库的创建、显示、删除和修改操作介绍
- HiveQL中如何排查数据倾斜问题
- Hive编程(五)【HiveQL:数据操作】
- hiveQL例子
- HiveQL详解
- Python数据处理
- PAT甲级 1002. A+B for Polynomials (25) 题目翻译与答案
- 尾递归以及在浏览器中的实现
- MySQL事务隔离级别和Spring事务关系介绍
- 【数据结构与算法】 一些知识点零零总总(引用网络知识点节选重组)
- HiveQL:数据定义
- 109. Convert Sorted List to Binary Search Tree
- CPU Notes
- tomcat注册为系统服务后,项目无法启动或者启动后页面中文乱码
- UVA12100 Printer Queue 【双端队列】
- Android学习笔记之蓝牙通信...
- SVG(可缩放矢量图形)绘制工具Method Draw
- docker原理及基本概念
- 问题四十二:怎么用ray tracing画任意圆环片段