Javatpoint Logo
Javatpoint Logo

PostgreSQL INSERT Statement

In PostgreSQL, the INSERT query is used to insert new rows into a table. You can insert a single row or multiple rows at a time into the table.

Syntax:

Note: column1, column2,...columnN are the names of the columns in the table into which you want to insert data.


PostgreSQL Insert statement using UI

Let's take an example to see how to insert values in a table. Here, we have a table name "EMPLOYEES":

postgre insert

Follow these steps to insert values in the table "EMPLOYEES":

  • Select table "EMPLOYEES" and right click on that. You will see an option script, move your cursor over scripts, you will see "INSERT script" option. Click on that.
  • You will get a page like this:
  • postgre insert
  • Put the values on the place of "?" and then click on the "play" button (marked in red circle) to execute the query. postgre insert

See the output:

You can see the output of the selected table by clicking on the table like structure marked in red circle.

postgre insert

Output:

postgre insert

PostgreSQL Insert Statement Using Query Tool

Open the query tool and execute the following query to insert multiple values in the table:

postgre insert

See the output:

You can see the output of the selected table by clicking on the table like structure marked in red circle.

postgre insert

Output:

postgre insert
Next TopicPostgreSQL Select




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA