📄️ Case Statement
The CASE statement performs a switch based on a condition. The basic form is identical to the ternary condition used in many programming languages (CASE WHEN cond THEN a ELSE b END is equivalent to cond ? a : b). With a single condition this can be expressed with IF(cond, a, b).
📄️ Casting
Casting refers to the process of changing the type of a row from one type to another. The standard SQL syntax for this is CAST(expr AS typename). DuckDB also supports the easier to type shorthand expr::typename, which is also present in PostgreSQL.
📄️ Collations
Collations provide rules for how text should be sorted or compared in the execution engine. Collations are useful for localization, as the rules for how text should be ordered are different for different languages or for different countries. These orderings are often incompatible with one another. For example, in English the letter "y" comes between "x" and "z". However, in Lithuanian the letter "y" comes between the "i" and "j". For that reason, different collations are supported. The user must choose which collation they want to use when performing sorting and comparison operations.
📄️ Comparisons
Comparison Operators
📄️ IN Operator
The IN operator checks containment of the left expression inside the set of expressions on the right hand side (RHS). The IN operator returns true if the expression is present in the RHS, false if the expression is not in the RHS and the RHS has no NULL values, or NULL if the expression is not in the RHS and the RHS has NULL values.
📄️ Logical Operators
The following logical operators are available
📄️ Expressions
An expression is a combination of values, operators and functions. Expressions are highly composable, and range from very simple to arbitrarily complex. They can be found in many different parts of SQL statements. In this section, we provide the different types of operators and functions that can be used within expressions.
📄️ Star Expression
Examples
📄️ Subqueries
Scalar Subquery