CREATE TABLE IF NOT EXISTS emp.employee ( id int, name string, age int, gender string )
COMMENT 'Employee Table' ROW FORMAT DELIMITED FIELDS TERMINATED BY ',';
Show Tables
SHOW TABLES; // This shows all tables from the current database
SHOW TABLES in emp; // This shows all tables in the emp database
CREATE TABLE IF NOT EXISTS emp.employee (
id int,
name string,
age int,
gender string )
COMMENT 'Employee Table'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ',';
External Table
CREATE EXTERNAL TABLE emp.employee_external (
id int,
name string,
age int,
gender string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
LOCATION '/user/hive/data/employee_external';
Hive – Load Data Into Table
In hive with DML statements, we can add data to the Hive table in 2 different ways.
Using INSERT Command
Load Data Statement
INSERT INTO TABLE emp.employee VALUES ('Dikshant',1,'95'),('Akshat', 2 , '96'),('Dhruv',3,'90');
2. Load Data Statement
LOAD DATA LOCAL INPATH '/home/dikshant/Documents/data.csv' INTO TABLE student;
Insert overwrite Directory
INSERT OVERWRITE DIRECTORY '/output/data_delimited'
SELECT *
FROM data_schema.data_table