PostgreSQL

PostgreSQL, often simply Postgres, is an object-relational database management system (ORDBMS) available for many platforms including Linux, FreeBSD, Solaris, Microsoft Windows and Mac OS X.[4] It is released under the PostgreSQL License, which is an MIT-style license, and is thus free and open source software.

PostgreSQL

Convert interval to number in postgresql

4 Feb, 2021
There is a simple function for when you need to extract count of days from interval. It is returned as as double, but converted to integer in this example. You get interval when you subtract two...
PostgreSQL

Move tables to another schema in Postgres

26 Nov, 2020
This form moves the table into another schema. Associated indexes, constraints, and sequences owned by table columns are moved as well.
PostgreSQL

Trim all whitespace in PostgreSQL

11 Nov, 2020
In PostgreSQL, the trim() function can be used to remove leading and trailing whitespace from a string. However, if you want to remove all whitespace from a string, you can use a combination of the...
PostgreSQL

Compare values between two tables in PostgreSQL

25 Mar, 2020
In PostgreSQL, the EXCEPT operator is used to retrieve distinct rows from the result set of the first query that are not present in the result set of the second query. It effectively performs a set...
PostgreSQL

Clone/Duplicate a Table in PostgreSQL

25 Mar, 2020
This snippet shows you how you can copy a whole table to another one. Useful if you are about to change data in a table and later need to compare it with EXCEPT.
PostgreSQL

PostgreSql return inserted row primary key

28 Nov, 2019
When you have primary keys generated by the database not by the application, then you might need it to be returned. In postgres you have to use RETURNING function in your sql query in order to have...
PostgreSQL

Get tables names in PostgreSQL

17 Feb, 2012
Get tables names in PostgreSQL.