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.
Use 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)
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Use 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)