In this post, I am going to share How to create PGAdmin III functions and use. Most of time we have long queries for fetching the records from the database , we generally use for making the queries shorter and less load on the server.
Moreover, when we have to reuse the same SQL queries in more than one SQL queries or functions.
Look into the below steps for more clarification:
- Right click on the functions option under the DataBaseName -> schemas -> Public -> Functions and click on New Function as shown on the below snapshot:
- After that a new window will open asking for new function name under properties, SQL query language under Definition and SQL query under code button as shown on the below snapshots:
Steps for using functions with in a SQL query:
- After successfully creating the function Open the SQL editor and writing the function name with parameters and running as shown on the below snapshot:
- Here we have call the form2_productcountbyproduct(product.product_id) function with product.product_id – parameter as form2_productcount.