Database: SQL: Autoincrement fields

Autoincrement fields

Because it is very common to have unique keys that are simply assigned sequential integers, most database systems have a way to do this automatically. Such a field is typically marked as AUTOINCREMENT or AUTO_INCREMENT. When you are inserting rows which have an autoincrement field, you will usually either put a NULL in it or leave it out of the column specification. In this case the system will supply the next unique value for that field. Although it is very commonly implemented, this is not in the SQL1 or SQL2 standards.