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
- First select the database, in which you want to create table.
- Left click on the box type structure associated with the selected database. You will see catalogs and schema.
- Left click on the box type structure associated with the schema. Now, you can see public.
- Left click on the box type structure associated with the public. You will get table.
- 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:
Here the created table is student:
Output:
PostgreSQL Create Table using Query tool
- Follow the above 4 steps.
- Go to the tools on the top most line.
- Left click on the tool and you will get Query tool. Click on the query tool and put your "CREATE Table" query here.
- 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:
Here, you can see the newly created table employees:
Output:
|