CREATE TABLE
The SQL statement that defines a new table: its name, columns, types and constraints.
In more detail
Everything that should always be true of the data, such as keys, NOT NULL, CHECK and foreign keys, is declared here. The same statement is standard enough to run nearly unchanged on SQLite and PostgreSQL, apart from type names and extras like STRICT.
Related terms
- table — A named set of rows that all have the same columns, where each row records one fact about one thing.
- schema — A formal description of the structure of data: which fields or columns exist, their types and which are required.
- constraint — A rule the database enforces on stored data, such as a column that must be unique or not null.
- data type — The kind of a value, such as a whole number, text or a date, which decides what you can do with it and how it compares and sorts.
Taught in
- Why Tables And Relations Beat Files — PostgreSQL, Indexing & Relational Data Modeling
- Data Types And What To Choose — PostgreSQL, Indexing & Relational Data Modeling
- Keys, Constraints And Referential Integrity — PostgreSQL, Indexing & Relational Data Modeling