Using column defaults

You can use the CREATE TABLE statement to create column defaults at the time a table is created, or the ALTER TABLE statement to add column defaults at a later time.

Example

The following statement adds a condition to an existing column named id in the sales_order table, so that it automatically increments (unless a client application specifies a value):

ALTER TABLE sales_order MODIFY id DEFAULT AUTOINCREMENT