tags:

views:

27

answers:

2

i want to add a new column noOfTry in a table which already have some columns. the column data will be integer type and default value will be 0. i know i need to use alter query, just asking for the correct format of the query for this case

+1  A: 
alter table `database`.`table` 
   add column `noOfTry` int(11) DEFAULT '0' NULL after `column`;

where column is the column before the on you want to add if you want to add in the middle of the table but this is optional.

laurent-rpnet
+1  A: 

The simplest option would be

ALTER TABLE MyTable ADD COLUMN noOfTry INT NOT NULL DEFAULT 0;
Rowland Shaw