Experts in Postgres and Open Source Infrastructure

24x7, 365 Enterprise services since 1997


This is the Education section of the Command Prompt Website. Here you will find blogs specifically about how to use Postgres and related technologies.

How to Add/Set a Default Value to a Column in PostgreSQL

In Postgres, the DEFAULT keyword is used with the help of CREATE TABLE or ALTER TABLE statement to set a default value to a column.

How to Extract Year From DATE in PostgreSQL

To extract a year from a date, the built-in EXTRACT() and DATE_PART() functions are used in Postgres. To do so, pass the “YEAR" and the timestamp as arguments to any of these functions.

PostgreSQL DELETE CASCADE With Examples

In PostgreSQL, the DELETE CASCADE feature allows us to delete the records associated with some other tables (via foreign key constraints).

How to Group by Month in PostgreSQL

In Postgres, the EXTRACT(), DATE_TRUNC(), and DATE_PART() functions are used to extract the month from a date field and then use the GROUP BY clause to group the results by month.

How to Subtract Days From a Date in PostgreSQL

In PostgreSQL, the DATE_PART() function, INTERVAL, and the minus “-” operator is used to subtract a single or multiple days from a particular date.

PostgreSQL NOT Operator/Condition With Examples

The NOT operator is a frequently used operator in Postgres that negates a boolean expression. It allows us to filter or exclude certain data from the query’s result set.

Comparison Operators in PostgreSQL

PostgreSQL offers a wide range of comparison operators, including basic and advanced ones, such as =, <, <>, BETWEEN, IN, etc.

PostgreSQL Numeric Data Type With Practical Examples

In PostgreSQL, the NUMERIC data type is a more precise data type used to store decimal values. It can be defined with specific precision and scale.

How to List Sessions/Active Connections in PostgreSQL

Postgres allows you to find the list of active connections on your database server via the "pg_stat_activity" and pgAdmin's "Server Activity panel”.

How to Show List of All Databases and Tables in PostgreSQL

In Postgres, the “\l”, “\list”, and “pg_catalog” are used to show the list of databases, while the “\dt” and “pg_catalog.pg_table” are used to show the list of relations.