![]() Then new IDs with start from this value + 1ĪLTER TABLE table_name AUTO_INCREMENT = new_start_value If a value larger than the current max ID value is explicitly inserted, LAST_INSERT_ID returns ID for the first successfully inserted row in multi-row INSERT LAST_INSERT_ID returns the last value inserted in the current session DOUBLE and FLOAT are allowed but deprecated. Omit the AUTO_INCREMENT column in INSERT, or specify NULL or 0ĭata type of column must be an integer. ![]() Get generated ID SELECT LAST_INSERT_ID ( ) Insert a row, ID will be automatically generated INSERT INTO airlines (name ) VALUES ( 'United Airlines' ) Name VARCHAR (90 ) ) AUTO_INCREMENT = 100 Quick Example: - Define a table with an auto-increment column (id starts at 100) CREATE TABLE airlines
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |