May 2018
Beginner to intermediate
452 pages
11h 26m
English
SQL tables are created using the CREATE TABLE command as shown in the following SQL query:
CREATE TABLE musicians (id SERIAL PRIMARY KEY, name TEXT NOT NULL, born DATE, died DATE CHECK(died > born));
In this example, we're creating a table called musicians. After the name, we specify a list of column definitions. Each column definition follows the format column_name data_type constraints.
In this case, we have the following four columns: