Modify Table Properties
1. Rename Table
Function: Using the ALTER TABLE command, you can rename an existing table to a new table name.
Syntax:
ALTER TABLE name RENAME TO new_table_name;
Example:
ALTER TABLE old_table_name RENAME TO new_table_name;
Function: Using the ALTER TABLE command, you can add or modify comments for external tables.
Syntax:
ALTER TABLE tbname SET COMMENT '';
Example:
ALTER TABLE new_pepole_delta SET COMMENT 'new_pepole_delta';
After executing the above command, you can use the DESC EXTENDED command to view detailed information about the table, including comments:
DESC EXTENDED new_pepole_delta;
+------------------------------+--------------------------------------------------------+---------+
| column_name | data_type | comment |
+------------------------------+--------------------------------------------------------+---------+
| id | int | |
| name | string | |
| dt | string | |
| # Partition Information | | |
| # col_name | data_type | comment |
| dt | string | |
| | | |
| # detailed table information | | |
| schema | public | |
| name | new_pepole_delta | |
| creator | UAT_TEST | |
| created_time | 2024-05-24 14:04:17.517 | |
| last_modified_time | 2024-12-30 11:47:32.806 | |
| comment | new_pepole_delta | |
| properties | () | |
| external | true | |
| type | TABLE | |
| clustered_keys | RANGE (__dt) | |
| bucket_count | 0 | |
| format | delta | |
| location | "oss://function-compute-my1/delta-format/uploaddelta/" | |
| connection | ql_ws.oss_delta | |
| statistics | NULL rows NULL bytes | |
+------------------------------+--------------------------------------------------------+---------+
3. Modify Table Properties
Function: Using the ALTER TABLE command, you can set or modify properties for external tables. Currently reserved parameters.
Syntax:
ALTER TABLE table_name SET PROPERTIES("key"="value");