1. To modify the table name through Impala shell, the basic syntax is as follows:
ALTER TABLE o_tb_name RENAME to N_tb_name;
Modify the Student table named EMP:
ALTER TABLE student RENAME to EMP;
Execute the statement and verify the result:
2. Add a column to the table through Impala shell, with the following basic syntax:
ALTER TABLE tb_name ADD COLUMNS (cn1 data_type,...);
Add a list of address information to the EMP table:
ALTER TABLE emp ADD COLUMNS (address STRING);
Query the table structure information to verify that it was added successfully:
DESCRIBE EMP;
Executes the statement with the following result:
3. By using Impala Shell to remove a column from the table, the basic syntax is as follows:
ALTER TABLE tb_name DROP [COLUMN] c_name;
Delete the Address field from the EMP table:
ALTER TABLE emp DROP COLUMN address;
Query the table structure information to verify that the deletion succeeded:
DESCRIBE EMP;
4. Clear the table through Impala shell, basic syntax:
TRUNCATE table_name;
Empty the contents of the EMP table:
TRUNCATE EMP;