# Create a View

In 
Published 2022-12-03

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

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

Right click on "Views", choose "Create", choose "View ...".

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

In the "Definition" tab, enter the SELECT of the view, if the view is a "Security Barrier" view and the "Check options".

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

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

Click on "Save" to create that view.

CREATE OR REPLACE VIEW "mySchema"."myView" AS
 SELECT "EMP".id,
    "EMP".firstname,
    "EMP".surname
   FROM "mySchema"."EMP";
 
ALTER TABLE "mySchema"."myView"
    OWNER TO postgres;