Recent Posts

SQL: Day Of Week By Name For A Date

less than 1 minute read

By using the to_char() function with a date or timestamp, we can determine the day of the week by name (e.g. Monday). For instance, to determine what day tod...

SQL: Count Records By Type

less than 1 minute read

If you have a table with some sort of type column on it, you can come up with a count of the records in that table by type. You just need to take advantage o...

PSQL: Terminating A Connection

less than 1 minute read

Consider the scenario where you are trying to drop a database, but there are existing connections.

PSQL: List Connections To A Database

less than 1 minute read

The pg_stat_activity table can be used to determine what connections there currently are to the PostgreSQL server and to a particular database. To see the pr...