RDB/MySQL
MySQL table / column rename
세모데
2020. 6. 29. 15:52
1. Rename to table name
1) single
alter table table_name rename to new_table_name ;
2) multiple
rename table table_name1 to new_table_name1,
table_name2 rename to new_table_name2 ;
If there exist comment related to table, it must be included to it when alter command execute.
2. Rename to column name
Currently, there is no exist for rename command of column so you use the change command.
alter table table_name change column old_column new_column varchar(10).
If there exist comment and default value etc related to column, it must be included.