Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Consider you have the following three tables which have to be linked together.

853


What is max connections in mysql?

876


Is mysql free for commercial use?

849


What is the use of procedure in mysql?

883


what is the difference between gui testing and database testing? : Mysql dba

1012


Write a command with which mysql table can be repaired

886


How does mysql clustering work?

849


Is mysql free for enterprise?

849


Can I use mariadb instead of mysql?

865


What is normalization and list the different types of normalization?

907


How show all tables in mysql query?

863


Is mysql a free database?

891


How can we get total number of records by query in mysql?

854


How to write after insert event update trigger on the same table in mysql?

908


Where is mysql password stored?

873