Autoincrement values in column in SQLite database

Total Post:10

Points:72
 1487  View(s)
Ratings:
Rate this:
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.
  1. Post:214

    Points:1642
    Re: Autoincrement values in column in SQLite 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)

Answer