Table Basics#

Tables consist of columns and rows.

The number and order of columns is fixed. Each column has a data type which constrains the set of possible values assignable to it, and enables computation e.g math for numbers and concatenation for strings.

Depending on column type, a table can have as many as 250 - 1600 columns.

The number of rows reflects the amount of data stored, and order is not guaranteed. A table can have duplicate rows.

Creating Tables#

Use the CREATE TABLE command. Specify a table name, column names and column data types.

mydb=> CREATE TABLE customers (
mydb(>    first_name   text,
mydb(>    last_name    text,
mydb(>    address      text
mydb(> );
CREATE TABLE

Deleting Tables#

Use the DROP TABLE command:

mydb=> DROP TABLE customers;
DROP TABLE