diff --git a/py-polars/docs/source/reference/sql/functions/temporal.rst b/py-polars/docs/source/reference/sql/functions/temporal.rst index a5fb918910653..8e6e5373fd977 100644 --- a/py-polars/docs/source/reference/sql/functions/temporal.rst +++ b/py-polars/docs/source/reference/sql/functions/temporal.rst @@ -11,12 +11,15 @@ Temporal - Converts a formatted string date to an actual Date type. * - :ref:`DATE_PART ` - Extracts a part of a date (or datetime) such as 'year', 'month', etc. + * - :ref:`EXTRACT ` + - Offers the same functionality as `DATE_PART` with slightly different syntax. .. _date: DATE ---- -Converts a formatted string date to an actual Date type; ISO-8601 format is assumed unless a strftime-compatible formatting string is provided as the second parameter. +Converts a formatted string date to an actual Date type; ISO-8601 format is assumed +unless a strftime-compatible formatting string is provided as the second parameter. **Example:** @@ -38,3 +41,14 @@ Extracts a part of a date (or datetime) such as 'year', 'month', etc. SELECT DATE_PART('year', column_1) FROM df; SELECT DATE_PART('day', column_1) FROM df; + +.. _extract: + +EXTRACT +------- +Extracts a part of a date (or datetime) such as 'year', 'month', etc. + +.. code-block:: sql + + SELECT EXTRACT(isoyear FROM column_1) FROM df; + SELECT EXTRACT(minute FROM column_1) FROM df; diff --git a/py-polars/docs/source/reference/sql/set_operations.rst b/py-polars/docs/source/reference/sql/set_operations.rst index 43748bed57f85..5117f09cc6f6c 100644 --- a/py-polars/docs/source/reference/sql/set_operations.rst +++ b/py-polars/docs/source/reference/sql/set_operations.rst @@ -23,7 +23,8 @@ Set Operations UNION ----- -Combine the result sets of two or more SELECT statements into a single result set. +Combine the distinct result sets of two or more SELECT statements. +The final result set will have no duplicate rows. **Example:** @@ -37,7 +38,8 @@ Combine the result sets of two or more SELECT statements into a single result se UNION ALL --------- -Combine the result sets of two or more SELECT statements into a single result set. +Combine the complete result sets of two or more SELECT statements. +The final result set will be composed of all rows from each query. **Example:** @@ -51,7 +53,9 @@ Combine the result sets of two or more SELECT statements into a single result se UNION BY NAME ------------- -Combine the result sets of two or more SELECT statements into a single result set. +Combine the result sets of two or more SELECT statements by column name +instead of by position; if `ALL` is omitted the final result will have +no duplicate rows. **Example:**