Search the Community
Showing results for tags 'alter table'.
Found 2 results
I am trying to change the name of a field in a table, but it is part of the primary index. I can't figure out what the format is for dropping the primary index, altering the table field, creating the index with new field name.
I want to change various column names using: ALTER TABLE tablename CHANGE COLUMN oldname newname columntype; This is easy except for the last part (columntype). It seems silly to need to specify that since I don't want to change the column TYPE, only its name, but from what I've read, specifying columntype is mandatory. I need automated code, not show the table and manually view the columntype and manually input that. Thus I'd appreciate code that gives me $columntype. Thank you!