Hive is a data warehouse solution built on top of Hadoop. In Hive data is managed at Hadoop Distributed file system (HDFS). In this schema, on reading no constraint check is required as it is required in RDBMS. It is particularly meant to work with a very large dataset. Hive uses query language known as Hive Query Language (HQL).
Steps to Create Table using HQL on Unix:
Step 1: Write the command “hive” for creating a database.
Step 2: Create a new database.
hive(default)> create database name_of_database > ;
Step 3: To see all the databases present in the hive write command:
Step 4: To use the database created in step 2 write the command:
Step 5: For creating a table, use the following command:
hive(name_of_database)> create table table_name > ( > id int, > name string, > city string >);
Step 6: Table is created and to insert records in the table write command:
hive(name_of_database)> insert into table table_name > values (101,'Ayush','Saxena');
After pressing enter Hive query will automatically trigger the MapReduce job and processing will start.
Step 7: To display all records present in the table write the query:
>select * from table_name;