PGAdmin how to create a view

Today we are going to learn PGAdmin how to create a view. Most of time we have to reuse the same queries multiple time in our project, we can achieve it using the view option of PGAdmin, we can save the SQL queries under Views.

This is one of the best and short steps to create view:

  1. Right click on the Views option under the DataBaseName -> schemas -> Public -> Views and click on New View as shown on the below snapshot:
  2. After that a new window will open asking for new View name under properties and SQL query under Definition button as shown on the below snapshots:
  3. After that click OK and save the query.

 

Steps for using the view:

  1. After successfully saving the query in view, we can call the view in our SQL query and use it as shown on the below query:
    select * from view_form_name;
  2. We can also use it with WHERE condition:
    SELECT * FROM view_form_name WHERE name LIKE '%john%';
Facebooktwittergoogle_plusredditpinterestlinkedinmail
1 Star2 Stars3 Stars4 Stars5 Stars (13 votes, average: 5.00 out of 5)
Loading...

Leave a Reply

Your email address will not be published. Required fields are marked *