Skip to content

Database.Guide

Object-Relational

Add a Virtual Column to an Existing Table in Oracle

September 27, 2022 by Ian

If we need to add a virtual column to an existing table in Oracle Database, we can do so with the usual SQL ALTER TABLE statement.

Read more

Categories Oracle Tags computed columns, how to

Subtract Seconds from a Time Value in PostgreSQL

September 18, 2022 by Ian

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

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

Read more

Categories PostgreSQL Tags dates, how to, psql

How to Get the First Day of the Month in SQL

September 8, 2022 by Ian

Below are examples of using SQL to return the first day of the month across various DBMSs.

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

Read more

Categories MariaDB, MySQL, Oracle, PostgreSQL, SQL, SQL Server, SQLite Tags dates, how to

Add Seconds to a Time Value in PostgreSQL

August 24, 2022 by Ian

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

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

Read more

Categories PostgreSQL Tags dates, how to, psql

How to Delete Duplicate Rows that have a Primary Key in SQL

September 20, 2024August 3, 2022 by Ian

The following examples use SQL to delete duplicate rows that have a primary key or unique identifier column.

Specifically, the examples delete all duplicates except one. So for example, in the case of three identical rows, it deletes two of them and keeps one.

Read more

Categories MariaDB, MySQL, Oracle, PostgreSQL, SQL, SQL Server, SQLite Tags how to

2 Ways to Check if a Table has a Generated Column in PostgreSQL

August 1, 2022 by Ian

PostgreSQL has supported generated columns since version 12. Generated columns can be created easily with the CREATE TABLE and ALTER TABLE statements.

We can check whether a table contains a generated column or not with the following methods.

Read more

Categories PostgreSQL Tags computed columns, how to

PostgreSQL CASE Expression

July 28, 2022 by Ian

In PostgreSQL, the CASE expression compares a list of conditions and returns one of multiple possible result expressions.

The CASE expression is included in the SQL standard (ISO/IEC 9075), and most major RDBMSs support it.

Read more

Categories PostgreSQL Tags operators, psql, what is

Return Rows that Contain Only Non-Alphanumeric Characters in SQL

July 24, 2022 by Ian

Here are examples of using SQL to return rows that contain non-alphanumeric characters in various DBMSs.

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

Read more

Categories MariaDB, MySQL, Oracle, PostgreSQL, SQL, SQL Server, SQLite Tags how to

2 Ways to List All Tables in a PostgreSQL Database

July 19, 2022 by Ian

Here are a couple of options for getting a list of tables in a database in PostgreSQL.

The first option is a psql command, the second involves querying an information schema view.

Read more

Categories PostgreSQL Tags how to, psql

Return Only Numeric Values in SQL

July 5, 2022 by Ian

If you ever need to use SQL to return just the numeric values in a character column, the method you use will largely depend on your DBMS. Most DBMSs support regular expressions (regex), but some don’t. And some include functions that can detect numeric values.

Here are examples of how to do it in the more popular DBMSs.

Read more

Categories MariaDB, MySQL, Oracle, PostgreSQL, SQL, SQL Server, SQLite Tags how to
Older posts
Newer posts
← Previous Page1 … Page24 Page25 Page26 … Page74 Next →

About | Privacy Policy

© 2026 Database.Guide • All rights reserved