SQLite AUTOINCREMENT Keyword
Overview
Let’s understand the SQLite AUTOINCREMENT keyword in this tutorial. The SQLite AUTOINCREMENT keyword is used to auto-increment the value of a column in the table.
AUTOINCREMENT Keyword Syntax
We can auto-increment a column value by using the AUTOINCREMENT keyword when creating a table with a specific column name to auto-increment it.
The general syntax for using the AUTOINCREMENT keyword is as follows:
CREATE TABLE IF NOT EXISTS table_name(
column1 <constriants> AUTOINCREMENT,
column2 datatype,
…
columnN datatype,
);
For example:
CREATE TABLE IF NOT EXISTS voter (
voterID INTEGER PRIMARY KEY AUTOINCREMENT,
voterName TEXT NOT NULL,
voterAge INTEGER NOT NULL
);
—
SQLite Tutorials
SQLite tutorials on this website:
https://www.testingdocs.com/sqlite-database-tutorials/
For more information on SQLite, visit the official website: