https://www.postgresql.org › docs › current › functions-conditional.html
PostgreSQL: Documentation: 17: 9.18. Conditional ExpressionsThe 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.
Table 9.54 shows the specialized operators available for array types. In addition to those, the usual comparison operators shown in Table 9.1 are available for arrays. The comparison operators compare the array contents element-by-element, using the default B-tree comparison function for the element data type, and sort based on the first difference.
IF-THEN-ELSE statements add to IF-THEN by letting you specify an alternative set of statements that should be executed if the condition is not true. (Note this includes the case where the condition evaluates to NULL.)
https://www.postgresqltutorial.com › postgresql-plpgsql › plpgsql-if-else-statements
PL/pgSQL IF Statement - PostgreSQL TutorialThe if statement allows you to execute one or more statements based on a condition. PL/pgSQL provides you with three forms of the if statements: if then else. if then elsif. 1) PL/pgSQL if-then statement. The following illustrates the simplest form of the if statement: if condition then . statements;
Vidéos
https://docs.postgresql.fr › 15 › functions-conditional.html
9.18. Expressions conditionnelles - PostgreSQL. Les clauses CASE peuvent être utilisées partout où une expression est valide. Chaque condition est une expression qui renvoie un résultat boolean. Si le résultat de la condition est true, la valeur de l'expression CASE est le résultat result qui suit la condition, et le reste de l'expression CASE n'est pas traité.
https://stackoverflow.com › questions › 11299037
sql - PostgreSQL IF statement - Stack OverflowPostgreSQL doesn't have IF, instead use a SELECT CASE WHEN statement, as in: SELECT CASE WHEN 50<100 THEN 5 ELSE 10 END; which allows a: SELECT CASE WHEN 50<(select count(*) from sometable) THEN 5 ELSE 10 END from mytable; – Eric Leschinski.
https://docs.postgresql.fr › 10 › functions-conditional.html
9.17. Expressions conditionnelles - PostgreSQLL'expression SQL CASE est une expression conditionnelle générique, similaire aux instructions if/else des autres langages de programmation : CASE WHEN condition THEN résultat . [WHEN ...] [ELSE résultat] END. Les clauses CASE peuvent être utilisées partout où une expression est valide.
https://thelinuxcode.com › postgresql-if-else
An In-Depth Guide to Using IF-ELSE in PostgreSQLPostgreSQL provides IF-ELSE constructs for implementing such conditional logic in PL/pgSQL blocks. In this guide, we will comprehensively cover the usage of "PostgreSQL IF-ELSE" statements.
https://www.postgresql.org › docs › current › plpgsql-control-structures.htm
PostgreSQL: Documentation: 17: 41.6. Control StructuresIF-THEN-ELSE statements add to IF-THEN by letting you specify an alternative set of statements that should be executed if the condition is not true. (Note this includes the case where the condition evaluates to NULL.)
https://www.datacamp.com › tutorial › case-statements-in-postgresql
PostgreSQL CASE Statements & Examples using WHEN-THEN, if-else and ...Expand your conditional queries in PostgreSQL using CASE statements and conditional expressions. Follow examples using WHEN-THEN, if-else, & switch today!
https://www.postgresqltutorial.com › postgresql-tutorial › postgresql-case
PostgreSQL CASESummary: in this tutorial, you will learn how to use the PostgreSQL CASE conditional expression to form conditional queries. The PostgreSQL CASE expression is the same as IF/ELSE statement in other programming languages. It allows you to add if-else logic to the query to form a powerful query.
https://blog-postgresql.verite.pro › 2017 › 05 › 23 › psql-conditions.html
Les branches if/else/endif dans psql (PostgreSQL 10)Une nouveauté majeure du client psql de PostgreSQL 10 est le support des branchements conditionnels, exprimables via ces nouvelles méta-commandes: \if EXPR1. ... \elif EXPR2. ... \else. ... \endif.