How can we change the name and data type of a column of a
table?
Answer Posted / guru
You can change the column data type using this query:
Alter table table_name modify column_name datatype(length)
For example:
Alter table user modify name char(30)
You can change column name using this query:
Alter table table_name change old_column_name
new_column_name datatype(length)
For example:
Alter table user change user user_name char(30)
If you want to change column name and data type in single
query, then you use this query:
Alter table table_name change old_column_name
new_column_name new_datatype(10)
For example:
Alter table user change name user_name char(30)
For more details visit,
http://www.phponwebsites.com/2013/12/mysql-change-column-name.html
(for change column name)
http://www.phponwebsites.com/2013/12/mysql-change-column-datatype.html(for
change column datatype)
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Why do you think it is advised to not to use guid and character columns as clustered index arrays?
write a query to mysql in safe mode and to change the root password
How to decrement dates by 1 in mysql?
What can you do with mysql?
Is mysql workbench a dbms?
How do I connect to mysql database?
Is mysql port 3306 tcp or udp?
suppose data is copie to oracle to sql by using DTS. Actully it taken 2 hours. suppose some day distribute the server in the middle of 2 hours. after how can i get the data ?
What is the difference between truncate and delete in mysql?
Does mysql scale well?
What is mysql enterprise edition?
Why we use mysql workbench?
When to use order by in delete statement?
How to create a test table in your mysql server?
How many mysql connections can handle?