Sponsored Links
Ad by Google
Apache Hive is data warehouse tool to process structure dataset and it's based on Hadoop infrastructure. The syntax is very much similar to MySql database, Hive mainly used for data presentation phase unlike Pig, here is very nice article explained on the differences between Apache Hive and Apache Pig. Hive was developed at Facebook, but now it's a part of Apache project and known as one of the popular Apache project among other big data technologies.
In this tutorial, We will see Hive DDL Commands with simple example,hive ddl is a part of Hive Query Language and the ddl commands use in hive are very much similar to other databases like mysql.
If you are very new to hive, then you have to prepared your hive environment and here is a step by step guide to setup hive environment.
HiveQL: Data Definition Language
DROP COMMANDS:
That's it all about Hive DDL commands.
In this tutorial, We will see Hive DDL Commands with simple example,hive ddl is a part of Hive Query Language and the ddl commands use in hive are very much similar to other databases like mysql.
If you are very new to hive, then you have to prepared your hive environment and here is a step by step guide to setup hive environment.
HiveQL: Data Definition Language
- CREATE database database_name;
create database ddl_commands;
- CREATE schema schema_name;
create schema ddl_commands;
- CREATE table
create table t(t_name string);
- CREATE view
create view t_view as select * from t;
- CREATE function
CREATE function my_fun AS MainClass USING JAR myjar;
- CREATE index
CREATE index index_t on table t2(t_name) AS 'org.apache.hadoop.hive.ql.index.compact.CompactIndexHandler' WITH DEFERRED REBUILD;
- DESCRIBE database
DESCRIBE database ddl_commands;
- DESCRIBE schema
DESCRIBE schema ddl_commands;
- DESCRIBE table
DESCRIBE t1;
- DESCRIBE view_name
DESCRIBE t_view;
- TRUNCATE table
TRUNCATE t;
- ALTER database
ALTER database ddl_commands SET DBPROPERTIES ('creator' = 'javamakeuse');
- ALTER schema
ALTER schema ddl_commands SET DBPROPERTIES ('creator' = 'javamakeuse');
- ALTER table
ALTER table t SET TBLPROPERTIES ("comment"="table for learning");
- ALTER view
ALTER view t_view as select t_name from t;
- SHOW databases
SHOW databases;
- SHOW schemas
SHOW schemas;
- SHOW tables
SHOW tables;
- SHOW TBLPROPERTIES
SHOW TBLPROPERTIES t;
- SHOW PARTITIONS
SHOW PARTITIONS t;
- SHOW functions
SHOW functions;
- SHOW indexs
show index on t;
- SHOW columns
show columns from t;
- SHOW create table
show CREATE TABLE t;
- MSCK repair table
MSCK REPAIR TABLE t;
DROP COMMANDS:
- DROP index
drop index index_t on t;
- DROP view
drop view t_view;
- DROP table
drop table t;
- DROP database
drop database ddl_commands;
- DROP schema
drop schema ddl_commands;
That's it all about Hive DDL commands.
Sponsored Links
0 comments:
Post a Comment