When you try to add add new column to your table, by default the column should be added to end of your table. But you can add it wherever you want in a table. It is possible in mysql.
Consider a example. Table1 is name of table. Normally the table look this this:
Now you are going to add column after specific column. The mysql query is:
alter table Table1 add column Game_Tag varchar(30) AFTER Game_Name
The output look like this:
Now you will get column 'Game_Tag' is after 'Game_Name'.
Now you are going to add column before specific field. The mysql query is:
You can add multiple columns after particular column in mysql. The mysql query is:
Myql Query:
alter table tablename add column columnname datatype(length) AFTER specific field name
Add column after particular field in mysql:
Consider a example. Table1 is name of table. Normally the table look this this:
Now you are going to add column after specific column. The mysql query is:
alter table Table1 add column Game_Tag varchar(30) AFTER Game_Name
The output look like this:
Now you will get column 'Game_Tag' is after 'Game_Name'.
Add column at first in mysql:
Now you are going to add column before specific field. The mysql query is:
alter table Table1 add column Game_Tag varchar(30) FIRST
The output look like this:
Now you'll get output as column 'Game_Tag' is present first of your table.Add multiple columns after specific field in mysql:
You can add multiple columns after particular column in mysql. The mysql query is:
alter table Table1
add column Game_Tag varchar(30),
add column count int(10),
add column category varchar(30)
AFTER Image
The output look like this:
Now you added three columns after column 'Image'.
Related Post:
Related Post:
Change column name in mysql
Change column size in mysql table
Delete column in mysql table
Change column size in mysql table
Change column datatype in mysql
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
Change column size in mysql table
Change column datatype in mysql
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