PostgreSQL Compute Total Sum of Column

PostgreSQL Compute Total Sum of Column with GROUP BY

In this PostgreSQL tutorial, I will show you how to compute the total sum of columns in PostgreSQL. You will understand the function SUM() in this tutorial to compute the sum of all the values in a column. Also, I will explain to you the syntax of the SUM() function and how to use it. … Read more >>

PostgreSQL To_Char Date Format

Using PostgreSQL To_Char to Format Date in Table

In this PostgreSQL tutorial, I will show you how to use PostgreSQL TO_CHAR format date, which means you will understand how to use the TO_CHAR() function to format date in a meaningful way. I will also explain to you the importance of the PostgreSQL TO_CHAR() function and how it can be helpful in presenting the … Read more >>

Postgres Timestamp Comparison

Postgres Timestamp Comparison Using Greater Than Operator

In this PostgreSQL tutorial, I will show you the Postgres timestamp comparison to compare the timestamp value. I will explain to you “What is timestamp?” and also some operators and functions that you can use to compare timestamp values. Additionally, you will learn how to compare timestamps using different real-world examples with different operators and … Read more >>

Row_number in PostgreSQL

Ranking Rows Using Row_number in PostgreSQL

In this PostgreSQL tutorial, I will show you how to use row_number in PostgreSQL to assign a unique sequential integer as a rank to each row. I will also tell you the importance of the Row_number() function with syntax and examples. Additionally, you will understand how to implement Row_number() for ranking and pagination with the … Read more >>

How to Create Index If Not Exist in PostgreSQL

How to Create Index If Not Exist in PostgreSQL

In this PostgreSQL tutorial, I will show how to create index if not exist in PostgreSQL. You will learn about the syntax of creating an index and also you will learn how to create an index without using the IF NOT EXISTS clause. Then you will understand how to create an index using IF NOT … Read more >>

PL/pgSQL Block Structure in PostgreSQL

Block Structure in PostgreSQL Verifying User

In this PostgreSQL tutorial, I will show you how to implement PL/pgSQL block structure in PostgreSQL. The PL/pgSQL block structure acts as a prototype and is used when creating a function or procedure in PostgreSQL. Also, you will understand “What is anonymous code block” and the concept of subblocks. Additionally, you will understand how to … Read more >>

How to Return Record using PostgreSQL Function

Returning Record using PostgreSQL Function

In this PostgreSQL tutorial, I will show you how to return a record using the PostgreSQL function. You will understand the syntax of the function and also you will create one simple function to understand how you can define your own function with different parameters. Additionally, I will show how you can implement the function … Read more >>

PostgreSQL Add Foreign Key If Not Exist

PostgreSQL Add Foreign Key If Not Exist Registrations to Courses

In this PostgreSQL tutorial, how to add a foreign key if not exist in PostgreSQL, where you will understand why you need to add the foreign key to tables. Also, you will use the PL\PGSQL with table pg_constraint to check whether the existing table has a foreign key or not. I will also explain to … Read more >>

How to Rename Column If Exists in PostgreSQL

Renaming Column How to Rename Column If Exists in PostgreSQL

In this PostgreSQL tutorial, I will show you how to rename a column if exists in PostgreSQL, where you will understand how to check the column’s existence in the table before renaming the column. How to Rename Column If Exists in PostgreSQL Sometimes as business requirements change, you need to also rename the columns and … Read more >>

Format Number in PostgreSQL

Round() function to Format Number in PostgreSQL

In this PostgreSQL tutorial, I will show you how to format numbers in PostgreSQL, where you will understand different functions provided by PostgreSQL such as to_char, round() and etc. Additionally, you will understand how to use lpad() function with the numeric value, and use the to_char() function to format the numeric value with the currency … Read more >>