The Hivesql of Big Data

Source: Internet
Author: User
Tags create database hadoop ecosystem

Recently added learning Java basic algorithms, including several sorting algorithms, Binary tree (pre-order, sequential, sequence), queue and stack, BMP search, Generalized search algorithm, iterative and so on some skills (self-action absolutely more than simple theory to be strong, more practice)

Hive is an important part of the Hadoop ecosystem, reducing the difficulty of developing hadoop and synthesizing complex and redundant code into simple SQL statements. However, it is obviously not as flexible as the traditional mapreduce, but it improves the project development efficiency and the learning cost is low.

Mainly through learning video plus a variety of blogs and other materials, learning the basics of getting started SQL statements can be from the Novice tutorial above, hive Grammar of my main view is--https://www.cnblogs.com/HondaHsu/p/4346354.html

Hivesql is mainly divided into DDL and DML

Ddl

1. Create a table

Create [local] table table_name (column_name column_type [commet ' description '], ...)

Partitioned by (column_name,...)

Clustred by (column_name,..)

Order BY (COLUMN_NAME)//Note the difference from sort by is that the former is global and the current host

Row format delimited

field terminated by Char;

Stored as ...

Localtion Hdfs_path

Copy a table structure

CREATE TABLE table_name like like_table_name;

2. Modify the table

ALTER TABLE Table_name/column_name Rename to New_table_name/column_new_name; Modify Table Name

ALTER TABLE TABLE_NAME change [column] column_name column_new_name column_new_name_type [Commet]//Modify column name

ALTER TABLE table_name DROP CLOUMN_NAME/PARTITION_SEC;

ALTER TABLE table_name ADD column (column_name column_type)

ALTER TABLE table_name SET FILEFORMAT New_format;

3 deleting tables, partitioning

DROP TABLE table_name;

ALTER TABLE table_name DROP PARTITION_SEC;

4 Creating a Database

CREATE DATABASE database_name;

show databases;

Dml

Hive no insert into does not support one-to-one insertion, you can use Insert overwrite, load data [local]

Insert Overwrite table table_name

SELECT * from Other_table;

Local data [local] path ' URL ' into table table_name [partition]

Hive does not support equivalent connections like

SELECT * FROM table1 A and table B where a.cloumn = B.column;

You can use the left semi join instead

Insert overwrite can be directly directed out

Insert overwrite [LOCAL] directory ' select * from table;

In addition, join in hive supports only the equivalent query

Select A.column b.column from Table_name1 a joins table_name2 b on a.column = B.column;

DQL

SELECT [Column_name1,..] FROM table_name

[Where Where_condition]/[join ...]

[GROUP BY]

[Order By]/[sort by]

[Partition]

[Limit num]

There may be some problems, there is a lot to add.

The Hivesql of Big Data

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.