If i want to change column name from 'ABC' to 'ABCD', what is the easiest way to do it. and if the column is one of the primary index, how could i do it?
you can do an ALTER TABLE mytbl RENAME COLUMN oldnme TO newnme;However there are restrictions, like you can't rename a column if it's part of an index (for PI you will have to drop and recreate the table, for SI, drop indexes and then rename, create the SI again ...)For the complete list of restrictions, lookup the "Renaming Table Columns" section in data definitions manual.
Thank you. That works fine.
Just to clarify, the word "column" should not be in the statement.
ALTER TABLE mytbl RENAME COLUMN oldnme TO newnme;
not use column keyword here