# Create a Sequence

Published 2022-12-03

This tutorial explains to you how to create a sequence in PostgreSQL. We use pgAdmin4 and a PostgreSQL 9.6.

Here are the steps for creating a Sequence in PostgreSQL using the pgAdmin4 :

Right click on "Sequences", choose "Create", choose "Sequence ...".

In the "General" tab, enter the name, the owner , the schema where the Sequence will be created and the description of the Sequence.

In the "Definition" tab, enter the Increment, the Start value (by default = Minimum), the Minimum and Maximum Value, how many values will be cached and if the values will be Cycled.

In the "Security" tab, enter the Privileges and Security labels for the Sequence (not mandatory).

You can click on SQL tab to see the SQL command used for creating that Sequence.

Click on "Save" to create that Sequence.

Here is the code for creating that sequence in PostgreSQL:

CREATE SEQUENCE "mySchema"."mySequence"
    MAXVALUE 10000
ALTER SEQUENCE "mySchema"."mySequence"
    OWNER TO postgres;