Here are the SQL queries helpful to alter a table. The things you can do are add columns, add indexes, add keys, add buffer pools, and modify function parameters.
SQL ALTER statement: These You Can do
Here are database objects you can ALTER. The list is TABLE, INDEX, FUNCTION, MASK, TABLESPACE, SERVER, SEQUENCE, and THRESHOLD.
#1 Add a Column
Here you can add a new column for an existing Table. Also, you can modify the existing column data type.
ALTER TABLE table_name ADD COLUMN name_of_column;
#2 Add an Index
You cannot add a new Index to an existing Table. When you want to add a new index, you need to drop existing ones and create new ones.
The REGENERATE specifies that the index will be regenerated or rebuilt. This command is useful if an index is already created.
ALTER INDEX index_name REGENERATE;
#3 ADD Buffer pools
You can modify database parameters. For instance, you can add more buffer pools. Also, you can add storage or drop storage.
ALTER DATABASE database_name new_buffer_pool;
#4 ALTER Criteria of a Function
You can modify the parameters (criteria) of a user-defined function.
ALTER FUNCTION GET_TABLE
RESTRICT CARDINALITY 10000;
Summary
Usually, in production, the ALTER statement Admin will use it. But in the test regions, a developer can use ALTER statement.
References
Related Posts






