query

LEAST

PostgreSQL selects the smallest non-NULL argument; all NULL arguments yield NULL. SQLite scalar min propagates NULL.

Formal Syntax & Structure

sql syntaxsql
LEAST(value [, ...])

Working Example

Example Snippetsql
CREATE TABLE a(id int primary key,k int); CREATE TABLE b(k int); INSERT INTO a VALUES (1,10),(2,20),(3,NULL); INSERT INTO b VALUES (10),(10),(NULL);SELECT LEAST(2,NULL,7);
SQL Reference