• AUTO_INCREMENT 

An integer or floating-point column can have the additional attribute AUTO_INCREMENT . When you insert a value of NULL  (recommended) or 0  into an indexed AUTO_INCREMENT  column, the column is set to the next sequence value. Typically this is value +1 , where value  is the largest value for the column currently in the table. AUTO_INCREMENT  sequences begin with 1 . 

To retrieve an AUTO_INCREMENT  value after inserting a row, use the LAST_INSERT_ID()  SQL function or the mysql_insert_id() C API function. See Section 12.16, “Information Functions” , and mysql_insert_id(). 

If the NO_AUTO_VALUE_ON_ZERO  SQL mode is enabled, you can store 0  in AUTO_INCREMENT  columns as 0  without generating a new sequence value. See Section 5.1.11, “Server SQL Modes” . 

There can be only one AUTO_INCREMENT  column per table, it must be indexed, and it cannot have a DEFAULT  value. An AUTO_INCREMENT  column works properly only if it contains only positive values. Inserting a negative number is regarded as inserting a very large positive number. This is done to avoid precision problems when numbers “wrap”  over from positive to negative and also to ensure that you do not accidentally get an AUTO_INCREMENT  column that contains 0 . 

For MyISAM  tables, you can specify an AUTO_INCREMENT  secondary column in a multiple-column key. See Section 3.6.9, “Using AUTO_INCREMENT” . 

To make MySQL compatible with some ODBC applications, you can find the AUTO_INCREMENT  value for the last inserted row with the following query: 

SELECT * FROM tbl_name  WHERE auto_col  IS NULL 

This method requires that sql_auto_is_null  variable is not set to 0. See Section 5.1.8, “Server System Variables” . 

For information about InnoDB  and AUTO_INCREMENT , see Section 15.6.1.6, “AUTO_INCREMENT Handling in InnoDB” . For information about AUTO_INCREMENT  and MySQL Replication, see Section 17.5.1.1, “Replication and AUTO_INCREMENT” . 

• COMMENT 

A comment for a column can be specified with the COMMENT  option, up to 1024 characters long. The comment is displayed by the SHOW CREATE TABLE  and SHOW FULL COLUMNS  statements. 

• COLUMN_FORMAT 

In NDB Cluster, it is also possible to specify a data storage format for individual columns of NDB  tables using COLUMN_FORMAT . Permissible column formats are FIXED , DYNAMIC , and DEFAULT . FIXED  is used to specify fixed-width storage, DYNAMIC  permits the column to be variable-width, and DEFAULT causes the column to use fixed-width or variable-width storage as determined by the column’s data type (possibly overridden by a ROW_FORMAT  specifier). 

For NDB  tables, the default value for COLUMN_FORMAT  is FIXED . 

In NDB Cluster, the maximum possible offset for a column defined with COLUMN_FORMAT=FIXED  is 8188 bytes. For more information and possible workarounds, see Section 23.1.7.5, “Limits Associated with Database Objects in NDB Cluster” . 

COLUMN_FORMAT  currently has no effect on columns of tables using storage engines other than NDB . MySQL 8.0 silently ignores COLUMN_FORMAT . 

