current position:Home>[Hadoop] some simple commands of hive

[Hadoop] some simple commands of hive

2022-01-26 23:52:51 Whale fall

(1) start-up hive

[linux01 hive]$ bin/hive

(2) Display database

hive>show databases;

(3) Use default database

hive>use default;

(4) Show default Tables in the database

hive>show tables;

(5) establish student surface ,  and Declaration file separator ’\t’

hive> create table student(id int, name string) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';

(6) load /usr/local/data/student.txt  File to student Database table .

   Linux establish students.txt File edit file content , Upload files to hdfs in

hadoop fs - put /usr/local/data/student.txt /data

load data inpath '/data/student.txt' overwrite into  table student;

load data local inpath '/data/student.txt' into table student;

(7) Query the database

hive> select * from student;

Inquire about id

hive> select id from student;

(8) sign out hive window :

hive(default)>exit;

(9) stay hive cli How to view in the command window hdfs file system

   hive(default)>dfs -ls /;

copyright notice
author[Whale fall],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201262352505109.html

Random recommended