Région de recherche :

Date :

https://www.postgresqltutorial.com › postgresql-tutorial › postgresql-coalesce

PostgreSQL COALESCE() Function - PostgreSQL Tutorial

Let’s take some examples of using the COALESCE() function. 1) Basic PostgreSQL COALESCE () function examples. The following example uses the COALESCE() function to return the first non-null argument: SELECT COALESCE (1, 2); Code language: SQL (Structured Query Language) (sql)

https://stackoverflow.com › questions › 27479180

Using COALESCE to handle NULL values in PostgreSQL

You can use COALESCE in conjunction with NULLIF for a short, efficient solution: COALESCE( NULLIF(yourField,'') , '0' ) The NULLIF function will return null if yourField is equal to the second value ('' in the example), making the COALESCE function fully working on all cases:

https://www.enterprisedb.com › postgres-tutorials › how-use-coalesce-postgresql

How to use COALESCE in PostgreSQL - EDB

The COALESCE function returns the first non-NULL expression in the specified list. If all the arguments are NULL then it will return NULL as its output. The supported syntax is: COALESCE(value_1,value_2,value_3,........value_n) The parameters or arguments are: value_1,value_2,value_3,........value_n.

https://www.postgresql.org › docs › current › functions-conditional.html

PostgreSQL: Documentation: 17: 9.18. Conditional Expressions

COALESCE(value [, ...]) The COALESCE function returns the first of its arguments that is not null. Null is returned only if all arguments are null. It is often used to substitute a default value for null values when data is retrieved for display, for example: SELECT COALESCE(description, short_description, '(none)') ...

https://docs.postgresql.fr › 10 › functions-conditional.html

9.17. Expressions conditionnelles - PostgreSQL

La fonction COALESCE renvoie le premier de ses arguments qui n'est pas nul. Une valeur NULL n'est renvoyée que si tous les arguments sont nuls. Cette fonction est souvent utile pour substituer une valeur par défaut aux valeurs NULL lorsque la donnée est récupérée pour affichage. Par exemple :

https://www.sqlshack.com › learn-the-postgresql-coalesce-command

Learn the PostgreSQL COALESCE command - SQL Shack

Coalesce in PostgreSQL. The coalesce function’s role is to return the first non-null value it encounters when reading from left to right. In addition, it can replace null values with a specified non-null value. The Coalesce function requires a minimum of two inputs.

Learn the PostgreSQL COALESCE command - SQL Shack

https://docs.postgresql.fr › 13 › functions-conditional.html

9.18. Expressions conditionnelles - PostgreSQL

COALESCE(value [, ...]) La fonction COALESCE renvoie le premier de ses arguments non NULL. NULL est renvoyé seulement si tous les arguments sont NULL. Elle est souvent utilisée pour substituer une valeur par défaut pour les valeurs NULL quand les données sont récupérées pour affichage. Par exemple :

https://www.tutorialsteacher.com › postgresql › coalesce-function

PostgreSQL COALESCE Function: Get First Non-NULL Value

In PostgreSQL, the COALESCE () function is used to get the first non-null value among the specified arguments. It returns the first of its arguments that is not null. If all arguments are NULL, it will return a NULL value. It is often used to substitute a default value for null values.

PostgreSQL COALESCE Function: Get First Non-NULL Value

https://www.stratascratch.com › blog › sql-coalesce-function-a-guide-for-postgresql-users

SQL COALESCE() Function: A Guide for PostgreSQL Users

Learn how to handle null values with ease and efficiency using the versatile COALESCE() function in PostgreSQL, with practical examples and insights.

SQL COALESCE() Function: A Guide for PostgreSQL Users

https://www.mazer.dev › en › databases › postgresql › posts › postgresql-guide-coalesce-function

PostgreSQL COALESCE Function: A Comprehensive Guide

This example demonstrates how to handle null or empty string values in categorical data in PostgreSQL using COALESCE and CASE WHEN. It showcases the utility of these functions in data cleaning and management, particularly in complex grouping and summing operations.