Data Definition Language

To create a table schema in SQL, you must use the create table command as follows:

      create table Supplier (
        sId integer primary key,
        name char(40) not null,
        city char(30) not null,
        address char(100) not null

This will create the Supplier table schema (also known as relation schema); this table will later hold values we pass into it. An attribute of the relation schema is specified by giving a name, a data type and a list of constraints.

(By default, tables will be added to the public database schema, but you can also define more database schemas to segment your database into groups.)

Data types can be: integer, numeric, char, date, and many more.

Common constraints are: primary key, references, not null, check, default.

The created table is empty at first, so you have to insert some rows into it before you can operate on the data.