📄️ 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. This section describes the different types of operators and functions that can be used within expressions.
📄️ CASE Expression
The CASE expression 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 operation of converting a value in a particular data type to the corresponding value in another data type.
📄️ 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 collection on the right hand side (RHS).
📄️ Star Expression
Syntax
📄️ Subqueries
Subqueries are parenthesized query expressions that appear as part of a larger, outer query. Subqueries are usually based on SELECT ... FROM, but in Goose other query constructs such as PIVOT can also appear as a subquery.
📄️ TRY expression
The TRY expression ensures that errors caused by the input rows in the child (scalar) expression result in NULL for those rows, instead of causing the query to throw an error.