- Command to launch hive CLI:
hive
- Command to connect to a database
use training_retail;
- Command to get list of tables in database
SHOW tables;
- Command to get columns and their datatypes in a table
DESCRIBE orders;
- Command to get all the meta-data related to a table
DESCRIBE FORMATTED orders;
- Command to create a demo table
CREATE TABLE orders_demo (order_id INT,order_date STRING,order_customer_id INT,order_status STRING) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',';
- Hive query to show first 10 records from a table
SELECT * FROM orders LIMIT 10;
- Query to get number of records in a table
SELECT count(1) FROM orders;