Javatpoint Logo
Javatpoint Logo

PostgreSQL Create Table

In PostgreSQL, CREATE TABLE statement is used to create a new table in any of the given database.

Syntax:


PostgreSQL Create Table using UI

  1. First select the database, in which you want to create table.
  2. Left click on the box type structure associated with the selected database. You will see catalogs and schema.
  3. Left click on the box type structure associated with the schema. Now, you can see public.
  4. Left click on the box type structure associated with the public. You will get table.
  5. Select table and make a right click on table. You will get a new table line. Click on that and create the table you desired.

See the example:

postgresql create table

Here the created table is student:

Output:

postgresql create table

PostgreSQL Create Table using Query tool

  1. Follow the above 4 steps.
  2. Go to the tools on the top most line.
  3. Left click on the tool and you will get Query tool. Click on the query tool and put your "CREATE Table" query here.
  4. Click on the "Play" button to execute your query.

Note: You can use shortcut key Ctrl+E to open the query tool.

See this example:

Execute the following query:

postgresql create table

Here, you can see the newly created table employees:

Output:

postgresql create table



Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA