# Create a Table

In 
Published 2022-12-03

This tutorial explains to you how to create a table in PostgreSQL. We use pgAdmin4 and a PostgreSQL 9.6.

Here are the steps for creating a table in PostgreSQL using the pgAdmin4 :

Right click on "Tables", choose "Create", choose "Table ...".

In the "General" tab, enter the name, the owner , the schema where the table will be created and the description of the table.

In the "Column" tab, enter the columns you want for that table and their attributes.

In the "Constraints" tab, enter the constraints you want for that table.

In the "Advanced" tab, enter the advanced options for that table or let them by default.

In the "Parameter" tab, enter the Parameters for that table if you want to modify something.

In the "Security" tab, enter the Security information if needed.

You can click on SQL tab to see the SQL command used for creating that table.

Click on "Save" to create that table.

Here is the code for creating this table in PostgreSQL:

CREATE TABLE "mySchema"."EMP"
(
    id integer,
    nume text,
    prenume text,
    data_created date,
    CONSTRAINT "EMP_PK" PRIMARY KEY (id)
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;
 
ALTER TABLE "mySchema"."EMP"
    OWNER to joe;

Now, if you want to modify the column names, for instance from "nume" to "firstname" and "prenume" to "surname" you can do this by altering the "Properties" of that table in pdAdmin: