Create table in pgAdmin 4 with autoincrement column

Open pgAdmin tool. Expand nodes in your database and go to the Tables node. Right click the Table node and choose Create->Table.

The Create-Table window appears. In Name field write name of the table.

Go to the Columns tab.

Click the plus icon to add column to the table. Click into Name field to write name of the column.

For first write id, select bigserial datatype if the values may be autoincrement. Set NOT NULL and PRIMARY KEY for this column.

Click the plus icon to add another column to the table. Write name of column and datatype.

Click the Save button to save all columns. Go to the Databases node and look at Table node.

The new people table is in it. The columns are definied on it.
Check if autoincremet work.Open SQL editor to right click the name of the table and choose Query Tool.

In SQL editor in pgAdmin write code:

INSERT INTO people(name) VALUES('Anne');

Execute this code clicking the property icon.

And to watch result, right click the name of table and choose View Data->View All Rows.

It is data:

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.