Experts in Postgres and Open Source Infrastructure

24x7, 365 Enterprise services 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 Round an Average to 2 Decimal Places in PostgreSQL

To find the average of a column we use the AVG() function taking the name of the column as a parameter. The ROUND() function rounds off a specified number up to particular decimal places.

How to Custom Sort in PostgreSQL ORDER BY Clause?

In PostgreSQL, the ordering is done by using the ASC and DESC keywords but we can also customize the sorting order using several ways, such as the CASE keyword, array_position() function, etc.

How to Change Primary Key in Postgres

To change a Primary key in Postgres, remove the existing primary key from the table, and add a new primary key using the “ALTER TABLE ADD PRIMARY KEY” statement.

How to Concatenate Columns in Postgres

To concatenate multiple columns in PostgreSQL, the CONCAT() function is used. Moreover, we can also use the concatenation operator “||”.

What Does NOT LIKE Operator Do in Postgres

The NOT LIKE operator looks for the specified character/text/string in the database and returns those records that do not contain that specified string/pattern.

How to Fix Error “function ntile() Does Not Exist” in PostgreSQL

In PostgreSQL, the error “function ntile() Does Not Exist” basically arises when we do not provide any argument to the ntile() function.

How to Create a Tablespace in PostgreSQL

To create a tablespace in PostgreSQL, the “CREATE TABLESPACE” statement is used with the “LOCATION” clause. It refers to the location on the disk where all the data for a database is stored.

How to Use REAL Data Type in PostgreSQL

The REAL data type is a numeric data type used to store the single-precision floating point numbers. It requires fewer storage constraints as compared to the DOUBLE PRECISION data type.

How to Get the First, Last, and nth value of a Partition in Postgres

In PostgreSQL, users can get the first, last, and any nth values from each partition using the FIRST_VALUE(), LAST_VALUE(), and NTH_VALUE(), respectively.

How to Run PostgreSQL Queries in psql

First, establish a connection with the postgres database from psql, after that, you can run all the PostgreSQL queries like DDL and DML in psql in similar ways as you run them in pgAdmin.