CREATE TABLE Statement, CONSTRAINT Clause Example

This example creates a new table called ThisTable with two Text fields.

CREATE TABLE ThisTable (FirstName TEXT, LastName TEXT);

This example creates a new table called MyTable with two Text fields, a Date/Time field, and a unique index made up of all three fields.

CREATE TABLE MyTable (FirstName TEXT, LastName TEXT, DateOfBirth DATETIME, 
CONSTRAINT MyTableConstraint 
UNIQUE (FirstName, LastName, DateOfBirth));

This example creates a new table with two Text fields and an Integer field. The SSN field is the primary key.

CREATE TABLE NewTable (FirstName TEXT, LastName TEXT, SSN INTEGER 
CONSTRAINT MyFieldConstraint PRIMARY KEY);