Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert a row in postgreSQL pgAdmin?

Tags:

postgresql

People also ask

How do I insert multiple rows in pgAdmin?

First, specify the name of the table that you want to insert data after the INSERT INTO keywords. Second, list the required columns or all columns of the table in parentheses that follow the table name. Third, supply a comma-separated list of rows after the VALUES keyword.

How do you insert a column in pgAdmin?

Syntax. The syntax to add a column in a table in PostgreSQL (using the ALTER TABLE statement) is: ALTER TABLE table_name ADD new_column_name column_definition; table_name.


The accepted answer is related to PgAdmin 3 which is outdated and not supported. For PgAdmin 4 and above, the application is running in the browser.

After you create your table, you have to make sure that your table has a primary key otherwise you couldn't edit the data as mentioned in the official documentation.

To modify the content of a table, each row in the table must be uniquely identifiable. If the table definition does not include an OID or a primary key, the displayed data is read only. Note that views cannot be edited; updatable views (using rules) are not supported.

1- Add primary key

Expand your table properties by clicking on it in the pgAdmin4 legend. Right-click on 'Constraints', select 'Create' --> 'Primary Key'to define a primary key column.

enter image description here

2- View the data in excel like format

Browser view, right-click on your table --> select View/Edit Data --> All Rows enter image description here

3- Add new row / Edit data

On the Data Output tab at the bottom of the table below the last row, there will be an empty row where you can enter new data in an excel-like manner. If you want to make updates you can also double click on any cell and change its value.

enter image description here

4- Save the changes

Click on the 'Save' button on the menu bar near the top of the data window. enter image description here


I think some answers don't provide an answer to the original question, some of them insert records but with SQL statements and the OP clearly said WITHOUT, so I post the right answer: (Step by Step) enter image description here enter image description here

enter image description here

enter image description here


enter image description here

Alternatively you can use the query tool:

INSERT INTO public.table01( name, age) VALUES (?, ?);

use the lightning icon to execute.


You can do that without the SQL editor, but it's better to do this by queries.

Although, in pgAdmin, there is an option which you can click to have an excel-like window where you can add and update data in a table without using SQL language. Please select a table which you want to add a row first and click on the next icon here below.

enter image description here