PostgreSQL Functions and Operators to Manipulate Data

Posted by

PostgreSQL functions have an in-built function to perform manipulation on data. All SQL database systems have data definition Language and data manipulation language tools to assist in creating and maintaining the database.

PostgreSQL Statement COUNT() Syntax example

The PostgreSQL COUNT() function is used to count the number of rows based on specific criteria.

SELECT COUNT(column_name)
FROM table_name
WHERE condition;

The PostgreSQL AVG() function is used to calculate the average value of numbers

SELECT AVG(column_name)
FROM table_name
WHERE condition;

The PostgreSQL SUM() function is used to find the sum of numerical data in a column

SELECT SUM(column_name)
FROM table_name
WHERE condition;


PostgreSQL Count() function is used to find the number of items in a column, NULL Values are not included during manipulation

select Count(name)
from table_name;

PostgreSQL AVG() function is used to find the average price of all products. when using the AVG() function usually the NULL values are not included

SELECT AVG(Price)
FROM Products;

PostgreSQL SUM() function SQL Statement is used to find the Sum of the Quantity fields in the table.NULL values are not included in the sum

SELECT SUM(Quantity)
FROM OrderDetails;

These functions in PostgreSQL Usually Assist Us when doing analytics so as to get clean and accurate Data. The manipulated data can then be consumed on visualization tools such as PowerBI and Qlik senses BI

How to install MySQL in Linux System

Leave a Reply

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