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 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.

Date Time Functions in PostgreSQL With Examples

Postgres offers a wide range of built-in functions to efficiently manipulate date and time values. For instance, NOW(), TO_TIMESTAMP(), CURRENT_DATE, etc.

PostgreSQL Date Types - Functions, Formats, and Intervals

This blog post explained date data types, functions, operators, formats, and intervals with the help of appropriate examples.

How to Add Days to a Date in PostgreSQL

Postgres allows us to add a certain number of days to a date field using the plus “+” operator. It retrieve a new date representing the original date plus the specified number of days.

PostgreSQL TIMESTAMP Data Types and Functions

PostgreSQL provides two temporal data types to deal with the TIMESTAMPS: TIMESTAMP(without the time zone) and TIMESTAMPTZ(with a time zone).

How to Find the Interval Between Two Dates in PostgreSQL

In PostgreSQL, finding the interval between two dates can be accomplished using the built-in AGE() function or the minus “-” operator.

How to Convert a TIMESTAMP to String in PostgreSQL

PostgreSQL provides a built-in TO_CHAR() function that converts the given timestamp to a string. It utilizes a format mask to convert the input value to a string.

How to Extract DOW in PostgreSQL?

In PostgreSQL, the EXTRACT() and DATE_PART() functions are used to extract a DOW(an acronym for Day of Week) from a date or timestamp.

PostgreSQL TO_CHAR Function With Practical Examples

In Postgres, a built-in function named TO_CHAR() is used to convert any data type, such as an integer, interval, timestamp, date, etc., to a string.

PostgreSQL CURRENT_TIME Function With Practical Examples

The CURRENT_TIME function retrieve the current time and the time zone. It can accept an optional parameter “precision” to set the precision of the retrieved fractional seconds.