Skip to content

Database.Guide

Object-Relational

How to Format Negative Numbers with Angle Brackets in Oracle

November 11, 2021 by Ian

When using the TO_CHAR() function to format a number in Oracle Database, you can use the PR format element to return negative values inside angle brackets (<>).

Read more

Categories Oracle Tags how to, number format

3 Ways to Format a Number as a Percentage in PostgreSQL

November 11, 2021 by Ian

We have several options if we want to display numbers with a percentage sign in PostgreSQL.

We can use the TO_CHAR() function to format the number along with the percentage sign. Or we can simply concatenate the number with the percentage sign, either with the CONCAT() function or with the concatenation operator.

Read more

Categories PostgreSQL Tags how to, number format

Add Leading Zeros in SQL

March 11, 2022November 10, 2021 by Ian

Below are examples of adding a leading zero to a number in SQL, using various DBMSs.

Read more

Categories Azure SQL Edge, MariaDB, MySQL, Oracle, PostgreSQL, SQL, SQL Server Tags how to, number format

Format a Number as a Percentage in Oracle

November 10, 2021 by Ian

Even though Oracle Database has a TO_CHAR(number) function that allows us to format numbers, it doesn’t provide a format element for the percentage sign.

Therefore, if we want to format a number as a percentage in Oracle Database, we need to concatenate the percentage sign and the number.

Read more

Categories Oracle Tags how to, number format

How to Export Query Results to a .txt File when using SQLcl (Oracle)

November 9, 2021 by Ian

When querying Oracle Database, you can use the SPOOL command to export your query results to a text file when using SQLcl.

Read more

Categories Oracle Tags export, how to, sqlcl

How to Remove the Trailing Spaces after the Month Name in Oracle

November 8, 2021 by Ian

If you’ve ever used the TO_CHAR() function to format a date that uses the month name, you might have noticed that sometimes the month is returned with right padding.

Read more

Categories Oracle Tags date format, dates, how to

LISTAGG() Function in Oracle

November 7, 2021 by Ian

In Oracle, the LISTAGG() function enables us to combine data from multiple rows in to a single row.

We have the option of specifying a separator (such as a comma). We can also order the results produced by the LISTAGG() function, and more.

Read more

Categories Oracle Tags aggregate functions, aggregation, what is

STRING_AGG() Function in PostgreSQL

November 6, 2021 by Ian

In PostgreSQL, we can use the STRING_AGG() function to return columns from a query as a delimited list.

Read more

Categories PostgreSQL Tags aggregate functions, aggregation, functions, what is

How to Show Null Values When Running Queries in psql (PostgreSQL)

November 6, 2021November 5, 2021 by Ian

By default, null values are returned as an empty string in psql. But this can easily be changed.

One reason you might want to change this is to avoid null values being confused with actual empty strings.

You can change this with the \pset null 'value' command.

Read more

Categories PostgreSQL Tags how to, psql

How POSITION() Works in PostgreSQL

November 5, 2021 by Ian

PostgreSQL has a POSITION() function that returns the first starting index of a specified substring within a string.

If the substring doesn’t exist in the string, then zero is returned.

Read more

Categories PostgreSQL Tags functions, string functions, what is
Older posts
Newer posts
← Previous Page1 … Page41 Page42 Page43 … Page74 Next →

About | Privacy Policy

© 2026 Database.Guide • All rights reserved