Yahoo Poland Wyszukiwanie w Internecie

Search results

  1. 15 wrz 2008 · The simple case: SELECT CASE <variable> WHEN <value> THEN <returnvalue> WHEN <othervalue> THEN <returnthis> ELSE <returndefaultcase> END AS <newcolumnname> FROM <table> The extended case:

  2. 28 maj 2024 · We can use either a CASE statement or an IIF() function to implement IF-THEN logic in SQL. In this tutorial, we’ll explore how to implement IF-THEN logic in SQL across various dialects such as SQL Server, MySQL, and PostgreSQL.

  3. The CASEexpression goes through conditions and returns a value when the first condition is met (like an if-then-else statement). So, once a condition is true, it will stop reading and return the result. If no conditions are true, it returns the value in the ELSEclause.

  4. 13 cze 2021 · Here are the CASE expression examples from the PostgreSQL docs (Postgres follows the SQL standard here): SELECT a, CASE WHEN a=1 THEN 'one' WHEN a=2 THEN 'two' ELSE 'other' END FROM test; or. SELECT a, CASE a WHEN 1 THEN 'one' WHEN 2 THEN 'two' ELSE 'other' END FROM test;

  5. 7 maj 2017 · The simple way to achieve this goal is to add a CASE expression to your SELECT statement. In this article, we'll introduce you to the syntax, formats, and uses of the CASE expression. The CASE expression is a conditional expression: it evaluates data and returns a result. The result it returns is based on whether the data meets certain criteria.

  6. 2 cze 2023 · You can probably write two CASE statements to display it: SELECT CASE WHEN MOD(yourcolumn, 2)=0 THEN yourcolumn ELSE null END AS evenvalue, CASE WHEN MOD(yourcolumn, 2)=1 THEN yourcolumn ELSE null END AS oddvalue FROM yourtable;

  7. The CASE expression in SQL server allows us to apply if-then-else logic in a SQL statement. A CASE consists of a number of conditions with an accompanying custom result value in a case body followed by an optional ELSE clause.

  1. Ludzie szukają również