Hive基础测试操作

一、Hive测试

  1.查看数据库

  show databases;

  2.使用某个数据库,如默认数据库

  user default;

  3.创建表

  create table if not exist itstar(id int,name string);

  4.插入数据

  insert into table itstar values(1,"wyh");

  5.查询

  select * from itstar;

扫描二维码关注公众号,回复: 5835070 查看本文章

  6.删除表

  drop table itstar;

  7.删除数据库

  create database hive_db;

  drop database if exist hive_db;

  8.退出Hive

  quit;

二、向Hive中的表导入文本数据

  1.在Hive中创建表

  create table students(id int,name string) row format delimited fields terminated by "\t";

  2.导入数据  

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

猜你喜欢

转载自www.cnblogs.com/HelloBigTable/p/10682684.html