Skip to content

Commit

Permalink
#2230
Browse files Browse the repository at this point in the history
  • Loading branch information
joocer committed Jan 31, 2025
1 parent da44008 commit 65b48e6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/contributing/internals/optimization-strategies.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ This optimization aims to reduce the work done to evaluate expressions by pre-ev
This optimization requires variables to be resolved so is run after the binder.

**improvements**
- filters which evaluate to `FALSE` (when `AND`ed) should prune the scan(s) below it
- filters which evaluate to `false` (when `AND`ed) should prune the scan(s) below it

### Predicate Rewriter

Expand Down
6 changes: 5 additions & 1 deletion docs/sql-reference/adv-null-semantics.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Most comparisons to `null` return `null`. Exceptions are generally in functions
When the outcome of a comparison is `null`, this will be coerced to `false` when used in a filter (`WHERE` or `HAVING`) but return as `null` in a `SELECT` statement.

To demonstrate, first a `null` comparison in a `SELECT` statement:

~~~sql
SELECT name = null
FROM $planets;
Expand Down Expand Up @@ -45,4 +46,7 @@ SELECT name
Also, returns an empty set.

!!! note
`null` comparison returning `null` holds true even for `null = null`. Do not test for null using an equals condition, use `IS NULL`.
`null` comparison returning `null` holds true even for `null = null`. Do not test for null using an equals condition, use `IS NULL`.

!!! note
A column which contains `null` values will return these `null`s as matches to a `!=` comparison, e.g. `WHERE name != 'bob'` will include rows with `null` in the name column.
2 changes: 1 addition & 1 deletion docs/sql-reference/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ For more details, see [Working with Structs](../adv-working-with-structs/).
Struct values can be `VARCHAR` or `BLOB` formatted JSON strings.

!!! function "_struct_ `->>` _key__varchar_ "
Return the value for **key** from **object**, non `NULL` values are cast to `VARCHAR`.
Return the value for **key** from **object**, non `null` values are cast to `VARCHAR`.
Struct values can be `VARCHAR` or `BLOB` formatted JSON strings.
_Related:_ `->` operator

Expand Down
6 changes: 3 additions & 3 deletions docs/sql-reference/joins.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ FROM left_relation NATURAL JOIN right_relation

A `NATURAL JOIN` performs a similar join to an `INNER JOIN ... ON` where the join conditions are automatically determined as equals conditions between columns with the same names in the two relations. This is not recommended in queries supporting production systems as these queries are brittle, especially in situations where schemas may change.

Performing a self `NATURAL JOIN` (the same relation for the left and right relations) removes rows which contain `NULL` values.
Performing a self `NATURAL JOIN` (the same relation for the left and right relations) removes rows which contain `null` values.

## LEFT JOIN

~~~
FROM left_relation LEFT [ OUTER ] JOIN right_relation ON condition
~~~

A `LEFT JOIN` returns all rows from the left relation, and rows from the right relation where there is a matching row, otherwise the fields for the right relation are populated with `NULL`.
A `LEFT JOIN` returns all rows from the left relation, and rows from the right relation where there is a matching row, otherwise the fields for the right relation are populated with `null`.

**Syntax**

Expand All @@ -95,7 +95,7 @@ A `RIGHT JOIN` is the same as a `LEFT JOIN` with the relations swapped.
FROM left_relation FULL [ OUTER ] JOIN right_relation ON condition
~~~

The `FULL JOIN` keyword returns all rows from the left relation, and all rows from the right relation. Where they have a matching value in the joining column, the rows will be aligned, otherwise the fields will be populated with `NULL`.
The `FULL JOIN` keyword returns all rows from the left relation, and all rows from the right relation. Where they have a matching value in the joining column, the rows will be aligned, otherwise the fields will be populated with `null`.

**Syntax**

Expand Down

0 comments on commit 65b48e6

Please sign in to comment.