Région de recherche :

Date :

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

PostgreSQL COALESCE() Function - PostgreSQL Tutorial

Learn how to use the COALESCE() function in PostgreSQL to return the first non-null argument from a list of arguments. See examples of using COALESCE() to handle null values in queries and compare it with NVL or IFNULL functions.

https://dba.stackexchange.com › questions › 307269 › postgres-function-for-nvl

postgresql - Postgres function for NVL - Database Administrators Stack ...

I'm trying to have NVL function in postgres. create or replace function nvl (anyelement, anyelement) returns anyelement language sql as $$ select coalesce(cast( $1 as decimal), cast( $2 as decimal)) $$; however this fails on me for the following examples:

https://stackoverflow.com › questions › 27479180

Using COALESCE to handle NULL values in PostgreSQL

SELECT. COALESCE( pt.incentive_marketing, '0' ), COALESCE(pt.incentive_channel,'0'), COALESCE( pt.incentive_advertising,'0') FROM test.pricing pt. WHERE pt.contract_id = 90000. group by 1,2,3. the result of which is as attached in image 2. I still receive one row with blank values.

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

How to use COALESCE in PostgreSQL - EDB

postgres=# SELECT coalesce(nvl(null,199),least(8,null),avg(9.9)); coalesce ----- 199 (1 row) Preventing NULL values with COALESCE. A helpful application of the COALESCE function is to prevent NULL values from appearing in query results. Example. 1. Create a table “sales” using the CREATE TABLE command:

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

PostgreSQL: Documentation: 17: 9.18. Conditional Expressions

The SQL CASE expression is a generic conditional expression, similar to if/else statements in other programming languages: CASE WHEN condition THEN result . [WHEN ...] [ELSE result] END. CASE clauses can be used wherever an expression is valid. Each condition is an expression that returns a boolean result.

https://learnsql.fr › blog › la-fonction-sql-coalesce-traitement-des-valeurs-nulles

La fonction SQL Coalesce : Traitement des valeurs nulles

NULL + interval '1 day' returns NULL. TRUE and NULL returns NULL. Travailler avec les amendes de transit. Pour expliquer le fonctionnement de la fonction SQL COALESCE, nous allons utiliser l'exemple guidé des amendes de transit.

https://dev.to › dbvismarketing › how-postgresqls-coalesce-function-simplifies-null-value...

How PostgreSQL's COALESCE Function Simplifies NULL Value Handling

COALESCE in PostgreSQL is an essential tool for any database professional, aimed at refining how NULL values are handled in SQL environments. In database operations, especially when data completeness is uncertain, COALESCE is invaluable: SELECT name, price, COALESCE(discount, 0) AS effective_discount FROM products;

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

9.18. Expressions conditionnelles - PostgreSQL

Cette fonction du standard SQL fournit des possibilités similaires à NVL et IFNULL, qui sont utilisées dans d'autres systèmes de bases de données.

https://medium.com › the-table-sql-and-devtalk › postgresql-coalesce-function-handling...

PostgreSQL COALESCE Function: Handling NULL Values

Let’s explore the COALESCE PostgreSQL function, taking a look at what it is, what it does, its pros and cons, and when to use it to handle NULL values in some real-world examples.

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

PostgreSQL COALESCE Function: A Comprehensive Guide

The COALESCE function in PostgreSQL returns the first non-null argument. It is effectively equivalent to the ISNULL function in SQL Server. The syntax for COALESCE is as follows: COALESCE(value1, value2, ..., valueN)