Impala Modify/delete/clear table operations

Source: Internet
Author: User

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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.