Tuesday, 8 July 2014

MySQL change column name query

Here is a generic form of the query to change a column name in MySQL table:

alter table TABLENAME change OLDCOLUMNNAME NEWCOLUMNNAME varchar (10) ;

Example using this query:

Alter table transaction change amount receivedamount varchar(10);

Here:

TABLENAME = TRANSACTION
OLDCOLUMNNAME = AMOUNT
NEWCOLUMNNAME = RECEIVEDAMOUNT

No comments:

Post a Comment