Name
CREATE TABLE — Define and create a new table
Syntax
column-def:
type-name:
column-constraint:
table-constraint:
foreign-key-clause:
conflict-clause:
Common Usage
CREATE TABLEdatabase_name
.table_name
(c1_name c1_type
,c2_name c2_type...
); CREATE TABLEdatabase_name
.table_name
AS SELECT * FROM... ; CREATE TABLE tbl ( a, b, c ); CREATE TABLE people ( people_id INTEGER PRIMARY KEY, name TEXT ); CREATE TABLE employee ( employee_id INTEGER PRIMARY KEY NOT NULL, name TEXT NOT NULL, start_date TEXT NOT NULL DEFAULT CURRENT_DATE, parking_spot INTEGER UNIQUE );
Description
The CREATE
TABLE
command is used to define a new table. It
is one of the most complex SQL commands understood by SQLite,
though nearly all of the syntax is optional.
A new table can be created in a specific database by qualifying the table ...
Get Using SQLite now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.