Postgres and Open Source Experts

Anytime. Anywhere. Since 1997.

Education

Professional Postgres and Open Source support

Command Prompt, Inc., is the oldest Postgres Company in North America and one of the oldest Open Source firms still operating today. We serve our clients with best in class expertise and professionalism. You can read more about support and services here:


You have landed at the largest single source of Postgres education blogs in the world. At Command Prompt, we believe deeply that the education of the community is critical to the continued success of Postgres and related technologies. We hope you find content you are looking for and don't hesitate to Contact us today for all your Postgres and Open Source consulting and support needs.

How to Select One Row From Each Group in PostgreSQL?

In PostgreSQL, the “SELECT DISTINCT ON” statement is used to select one row per group. The stated command selects and retrieves a random row from each group.

How Do I Use FILTER Clause to Have Multiple Counts in PostgreSQL?

In PostgreSQL, the FILTER clause can be used with the COUNT() function to do multiple counts on a particular table.

How Does the CONCAT_WS() Work in PostgreSQL

The CONCAT_WS() is an inbuilt string function and an extended form of the CONCAT() function which allows the users to put a specific separator between the strings to be concatenated

How to Get the Age in Years in PostgreSQL

In PostgreSQL, the AGE() function must be used with the DATE_PART() or the EXTRACT() function to get the age in years.

How to Get the Year Month and Day From an INTERVAL in PostgreSQL

In PostgreSQL, the DATE_PART() and EXTRACT() functions are used to get a specific date field such as a year, month, etc. from any date, timestamp, or interval.

How to RESET a SEQUENCE in PostgreSQL?

In PostgreSQL, the ALTER SEQUENCE command is used with the RESTART WITH clause to reset the value of a specific sequence.

MySQL’s GROUP_CONCAT() Equivalent in PostgreSQL

In PostgreSQL, the STRING_AGG() function can be utilized as an alternative to the MySQL's GROUP_CONCAT() function.

Find Maximum Values From a Row in PostgreSQL

Use the MAX() function along with a subquery to find a row having a maximum value in a given column. Users must use the subquery along with the WHERE clause to get the filtered result set.

How to Sort a Table By Month in PostgreSQL

Use the ORDER BY clause alongside the EXTRACT() function to sort a table by month. 'Month' must be passed as an argument to the EXTRACT() function.

How to Get the Column Type Using pg_typeof() Function in PostgreSQL?

To get the column’s type in Postgres all you need to do is simply pass the column name as an argument to the pg_typeof() function.