Many dialects of SQL support an AUTO INCREMENT feature. When inserting records into a table with AUTO INCREMENT enabled, the database will assign the next value automatically. In SQLite an integer id field that has the PRIMARY KEY constraint will auto increment by default!
Depending on how your database is set up, you may be using traditional ids or you may be using UUIDs. SQL doesn't support auto incrementing a uuid so if your database is using them your server will have to handle the changing uuid's for each record.
AUTO INCREMENT in SQLiteWe are using traditional ids in our database, so we can take advantage of the auto increment feature. Different dialects of SQL will implement this feature differently, but in SQLite any column that has the INTEGER PRIMARY KEY constraint will auto increment! So we can omit the id field within the INSERT statement and allow the database to automatically add that field for us!
Let's add some more records into our users table, but allow the database to automatically increment the id field. Add the following records to the database:
name: Lanceage: 20country_code: USusername: LanChrpassword: bootdevisbestis_admin: falsename: Tiffanyage: 28country_code: USusername: Tifferoonpassword: autoincrementis_admin: true