This command is used to add a column to an existing table.
ALTER TABLE [db_name.]table_name ADD COLUMNS (col_name data_type,...) TBLPROPERTIES(''COLUMNPROPERTIES.columnName.shared_column'='sharedFolder.sharedColumnName,...', 'DEFAULT.VALUE.COLUMN_NAME'='default_value');
Parameter |
Description |
---|---|
db_name |
Database name. If this parameter is not specified, the current database is selected. |
table_name |
Table name. |
col_name data_type |
Name of a comma-separated column with a data type. It consists of letters, digits, and underscores (_). NOTE:
When creating a CarbonData table, do not name columns as tupleId, PositionId, and PositionReference because they will be used in UPDATE, DELETE, and secondary index commands. |
The newly added column can be displayed by running the DESCRIBE command.