Database.Guide

Skip to content

Beginners

  • What is a Database?
  • Database Tutorial

SQL

  • SQL Tutorial
  • SQL Reference
  • SQL Joins Tutorial
  • SQL Transactions Tutorial
  • Basic SQL Queries

Categories

  • Azure SQL Edge (17)
  • Database Concepts (99)
  • Database Tools (72)
  • DBMS (9)
  • DuckDB (151)
  • MariaDB (424)
  • Microsoft Access (17)
  • MongoDB (265)
  • MySQL (602)
  • NoSQL (8)
  • Oracle (301)
  • PostgreSQL (480)
  • Redis (210)
  • SQL (697)
  • SQL Server (1,170)
  • SQLite (299)

Category: PostgreSQL

Subtract Months from a Date in PostgreSQL

Posted on April 25, 2022 by Ian

In PostgreSQL, we can use the - operator to subtract one or more months from a date.

Continue reading →
PostgreSQL dates, how to, psql

Return the Unix Timestamp in PostgreSQL

Posted on April 19, 2022April 19, 2022 by Ian

In PostgreSQL, we can use the extract() function along with the epoch argument to return the Unix timestamp.

We can return the Unix timestamp based on the current date/time, or we can get it based on another specified date/time.

Continue reading →
PostgreSQL dates, how to, psql

Fix “INSERT has more expressions than target columns” in PostgreSQL

Posted on April 17, 2022 by Ian

If you encounter an error that reads “INSERT has more expressions than target columns” when trying to insert data in Postgres, it’s because you’re trying to insert data into more columns than the table actually contains.

Continue reading →
PostgreSQL errors, how to

Subtract Minutes from a Time Value in PostgreSQL

Posted on April 16, 2022 by Ian

In PostgreSQL, we can use the - operator to subtract one or more minutes from a time value.

By “time” value, this could be an actual time value, a timestamp, or an interval. We can also subtract minutes from a date value or a date and time combination.

Continue reading →
PostgreSQL dates, how to, psql

Get the Number of Days in a Month in PostgreSQL

Posted on April 12, 2022 by Ian

Here’s an example of using PostgreSQL to return the number of days in a month, based on a given date.

Continue reading →
PostgreSQL dates, how to, psql

UPPER() – Convert to Uppercase in PostgreSQL

Posted on April 11, 2022 by Ian

In PostgreSQL, we can use the upper() function to convert lowercase characters to their uppercase equivalent, according to the rules of the database’s locale.

Continue reading →
PostgreSQL functions, how to, psql, what is

LOWER() – Convert to Lowercase in PostgreSQL

Posted on April 11, 2022 by Ian

In PostgreSQL, we can use the lower() function to convert uppercase characters to their lowercase equivalent, according to the rules of the database’s locale.

Continue reading →
PostgreSQL functions, how to, psql, what is

Get the First Day of the Month in PostgreSQL

Posted on April 10, 2022 by Ian

We can use the following method in PostgreSQL to return the first day of a given month.

This could be the first day of the current month, or the first day of the month based on a date that we specify.

Getting the first day of the month allows us to perform further calculations on the resulting date, like adding a certain number of days to the start of the month, etc.

Continue reading →
PostgreSQL dates, how to, psql

Add Hours to a Time Value in PostgreSQL

Posted on April 9, 2022 by Ian

In PostgreSQL, we can use the + operator to add one or more hours to a time value.

By “time” value, this could be an actual time value, a timestamp, or an interval. We can also add hours to a date value or a date and time combination.

Continue reading →
PostgreSQL dates, how to, psql

INITCAP() – Convert to Initial Caps in PostgreSQL

Posted on April 8, 2022 by Ian

In PostgreSQL, we can use the initcap() function to format a string of text to use initial capitals. That is, it converts the first letter of each word to upper case and the rest to lower case.

Continue reading →
PostgreSQL functions, how to, psql, what is
  • «
  • 1
  • …
  • 26
  • 27
  • 28
  • 29
  • 30
  • …
  • 48
  • »

About Database.Guide | Privacy Policy