Creating a New Table

You can create a new table by using the CREATE TABLE command, specifying the table name along with all column names and their types:
CREATE TABLE weather (
    city            varchar(80),
    temp_lo         int,           -- low temperature
    temp_hi         int,           -- high temperature
    prcp            real,          -- precipitation
    date            date
);
You can enter this into psql with the line breaks because psql will recognize that the command is not terminated until the semicolon is received.

White space (that is, spaces, tabs, and line breaks) can be used freely in SQL commands. That means you can type the command aligned differently than above, or even all on one line. Two dashes ("--") introduce comments. Whatever follows them is ignored up to the end of the line. SQL is case-insensitive about key words and identifiers. However, identifiers can be placed in double-quotes to preserve the case.

varchar(80) specifies a data type that can store arbitrary character strings up to 80 characters in length. int is the normal integer type. real is a type for storing single precision floating-point numbers. date should be self-explanatory. (Yes, the column of type date is also named date. This may be convenient or confusing—you choose.)

PostgreSQL supports the usual SQL types (int, smallint, real, double precision, char(N), varchar(N), date, time, timestamp, and interval) as well as other types of general utility and a rich set of geometric types. PostgreSQL can be customized with an arbitrary number of user-defined data types. Consequently, type names are not syntactical keywords except where required to support special cases in the SQL standard.

The second example will store cities and their associated geographical location:
CREATE TABLE cities (
    name            varchar(80),
    location        point
);
The point type is an example of a PostgreSQL-specific data type.

If you do not need a table any longer or if you want to recreate it differently, you can remove it using the following command:
DROP TABLE tablename;