Add column to existing table

by MD on 2010/01/10

1. Add a column in a table

ALTER TABLE `ess` ADD `day` DATE NOT NULL COMMENT 'date of the day' AFTER `recid` ,
ADD UNIQUE (
`day`
)

2. Or it can me similar to this also

ALTER TABLE `diary` ADD `duedate` DATE default "2010-01-01" COMMENT 'due date of the entry' AFTER `modified`

3. Third example

ALTER TABLE `diary_options` ADD `show_duedate` INT( 1 ) NOT NULL COMMENT 'to show duedate or not' AFTER `show_modified`

You may also like:

Leave a Comment

Previous post:

Next post: