Mysql Query:
Alter table table_name modify column_name datatype(length)
When you click the structure of table in your database, it is look like this:
Suppose you've to change datatype of column 'Game_name'. On that time you can change the field type. The mysql query is:
Consider the example:
table1 is name of this table.
table1 is name of this table.
Alter table table1 modify Game_name char(15)
Now your structure look like this:
Now your Game_name column type is changed from varchar into char.
Changing the multiple column datatype at the time in mysql:
You can change multiple column datatype at a time in mysql. The mysql query as follow as:
Mysql Query:
Alter table table1
modify No varchar(5),
modify No varchar(5),
modify Game_name char(15),
modify Image char(15)
Now your output look like this:
Now you will get output column 'No' with varchar, 'Game_name' with char and 'Image' with char in your mysql table.
Datatypes in mysql:
Related Post:
Change column name in mysql
Change column size in mysql table
Delete column in mysql table
Add column after specific field in mysql table
Move columns in mysql table
Change table name in mysql
Change column NOT NULL to NULL in mysql
Add primary key to existing column in mysql
how to add auto increment to existing column in mysql
How to remove auto increment from column in mysql
Change column size in mysql table
Delete column in mysql table
Add column after specific field in mysql table
Move columns in mysql table
Change table name in mysql
Change column NOT NULL to NULL in mysql
Add primary key to existing column in mysql
how to add auto increment to existing column in mysql
How to remove auto increment from column in mysql
Thank you
ReplyDelete