![]() ![]() ![]() 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 Omit the AUTO_INCREMENT column in INSERT, or specify NULL or 0 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 AUTO_INCREMENT option allows you to automatically generate unique integer numbers (IDs, identity, sequence) for a column.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |