I want to create a column in SQLite database that takes values(SerialNo or ID) automatically to be unique.
column value I want to start from 0.
How to implement it in database.
Autoincrement values in column in SQLite database
273218-Nov-2015
Home / DeveloperSection / Forums / Autoincrement values in column in SQLite database
Tarun Kumar
20-Nov-2015Use this- SQLite autoincrement syntax, at the time of table definition:
CREATE TABLE EMPLOYEE(id INTEGER PRIMARY EKY AUTOINCREMENT, name TEXT NOT NULL, age INT NOT NULL);
To insert values into this EMPLOYEE table, use syntax like this:
INSERT INTO EMPLOYEE (name, age) VALUES ('JOHN',25);
Column 'id' will increment its values by autoincrement feature of SQLite database.(by default increment will be from 1, and so on)