This tutorial will show you some common usage for working with tables. If you have no installed Hive yet please follow this tutorial.
Create Database
CREATE DATABASE test;
Use Database
use test;
A place for tutorials on programming and other such works.
This tutorial will show you some common usage for working with tables. If you have no installed Hive yet please follow this tutorial.
CREATE DATABASE test;
use test;
This tutorial will show you some common usage for working with tables. If you have no installed Hive yet please follow this tutorial.
Show Tables:
SHOW TABLES;
SHOW TABLES LIKE '*test*';
Table Creation:
CREATE TABLE test (
columnA STRING,
columnB VARCHAR(15),
columnC INT,
columnD TIMESTAMP,
columnE DATE
)
STORED AS ORC;
Table Creation with Partitioning:
CREATE TABLE test_partition (
columnA STRING,
columnB VARCHAR(15),
columnC INT,
columnD TIMESTAMP,
columnE DATE
)
PARTITIONED BY (columnF INT)
STORED AS ORC;
Inline Table Creation:
CREATE TABLE test_inline STORED AS ORC AS
SELECT *
FROM test;
Temporary Table Creation:
CREATE TEMPORARY TABLE temp (
columnA STRING,
columnB VARCHAR(15),
columnC INT,
columnD TIMESTAMP,
columnE DATE
)
STORED AS ORC;
DESC Table:
This will show you the basic definition of a table.
DESC test;
DESC EXTENDED Table:
This will show you the extended definition of a table.
DESC EXTENDED test;
Drop Table:
DROP TABLE IF EXISTS temp;
You must be logged in to post a comment.