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 (148)
  • 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)

Tag: how to

How to Get the Last Day of the Month in MySQL

Posted on April 13, 2022April 14, 2022 by Ian

We can use MySQL’s LAST_DAY() function to return the last day of a given month.

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

Continue reading →
MySQL dates, how to

2 Ways to Enable Word Wrap in SQLite

Posted on April 13, 2022 by Ian

When using one of SQLite’s tabular output modes, you can enable the --wrap option in order to limit the width of each column. This can be handy when the data contains long lines of text.

When we do this, we have the option of specifying “word wrap”, so that words don’t get cut off halfway through.

There are two ways to specify word wrap: use --wordwrap on or its shortcut -ww.

Continue reading →
SQLite how to

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

2 Ways to Return Rows that Contain Only Non-Alphanumeric Characters in MySQL

Posted on April 10, 2022 by Ian

Below are two options for finding those rows that only contain non-alphanumeric characters in MySQL.

Non-alphanumeric characters include punctuation characters like !@#&()–[{}]:;',?/* and symbols like `~$^+=<>“, as well as whitespace characters like the space or tab characters.

Continue reading →
MySQL how to

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

Fix Error: “SELECTs to the left and right of UNION do not have the same number of result columns” in SQLite

Posted on April 9, 2022 by Ian

If you’re getting “Error: in prepare, SELECTs to the left and right of UNION do not have the same number of result columns…” in when trying to use the UNION operator in SQLite, it’s because one of the SELECT statements is returning more columns than the other.

Continue reading →
SQLite errors, how to, operators

Calculate the Number of Seconds Since a Particular Date/Time in SQLite

Posted on April 8, 2022 by Ian

If you need to calculate the number of seconds that have passed since a given date and time, you can use the UNIXEPOCH() function.

Note that this function was introduced in SQLite 3.38.0, so it will only work if you’re using SQLite 3.38.0 or later.

Continue reading →
SQLite dates, how to
  • «
  • 1
  • …
  • 76
  • 77
  • 78
  • 79
  • 80
  • …
  • 181
  • »

About Database.Guide | Privacy Policy