1. Hive数据库操作:
创建数据库: CREATE DATABASE database_name COMMENT 'database comment' LOCATION '/path/to/database';
``` 查看数据库: SHOW DATABASES;
使用数据库: USE database_name;
删除数据库: DROP DATABASE IF EXISTS database_name;
2. Hive数据表操作:
创建表: CREATE TABLE table_name ( column1_name column1_type, column2_name column2_type, ... ) COMMENT 'table comment' ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TEXTFILE;
查看表: SHOW TABLES;
查看表结构:DESCRIBE table_name;
加载数据到表: LOAD DATA LOCAL INPATH '/path/to/data.txt' INTO TABLE table_name; ``` 查询表: SELECT * FROM table_name;
删除表: DROP TABLE IF EXISTS table_name;