SQLite CREATE TABLE query

Using the CREATE TABLE keyword you can create a table in SQLite. See the following example:

CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    username TEXT NOT NULL,
    email TEXT NOT NULL UNIQUE,
    password TEXT NOT NULL
);

This example creates the users table, containing 4 columns:

  • id (type integer, primary key)
  • username (type text, not allowed to be NULL)
  • email (type text, not allowed to be NULL, must be unique)
  • password (type text, not allowed to be NULL)