Skip to content

Commit

Permalink
apply grid layout to index pages, break out set operations
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-beedie committed May 28, 2024
1 parent fad28b3 commit 29e1888
Show file tree
Hide file tree
Showing 5 changed files with 240 additions and 112 deletions.
84 changes: 43 additions & 41 deletions py-polars/docs/source/reference/sql/clauses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,37 @@ SQL Clauses

* - Function
- Description
* - :ref:`SELECT <select>`
- Retrieves specific column data from one or more tables.
* - :ref:`FROM <from>`
- Specify the table(s) from which to retrieve or delete data.
* - :ref:`JOIN <join>`
- Combine rows from two or more tables based on a related column.
* - :ref:`WHERE <where>`
- Filter rows returned from the query based on specific condition(s).
* - :ref:`GROUP BY <group_by>`
- Group rows that have the same values in specified columns into summary rows.
* - :ref:`LIMIT <limit>`
- Control the number of rows returned.
* - :ref:`OFFSET <offset>`
- Skip a specified number of rows.
- Aggregate row values based based on one or more key columns.
* - :ref:`HAVING <having>`
- Filter groups in a `GROUP BY` based on specific condition(s).
* - :ref:`ORDER BY <order_by>`
- Sort the query result based on one or more specified columns.
* - :ref:`SELECT <select>`
- Retrieves specific data from one or more tables.
* - :ref:`UNION <union>`
- Combine the result sets of two or more SELECT statements into a single result set.
* - :ref:`LIMIT <limit>`
- Specify the number of rows returned, and .
* - :ref:`OFFSET <offset>` |
- Skip a specified number of rows.


.. _select:

SELECT
------
Select the columns to be returned by the query.

**Example:**

.. code-block:: sql
SELECT column_1, column_2 FROM df;
.. _from:

FROM
Expand Down Expand Up @@ -59,6 +73,13 @@ Combines rows from two or more tables based on a related column.
SELECT product_id FROM df_product LEFT JOIN df_categories USING (product_id)
.. _where:

WHERE
-----

Filter rows returned from the query based on specific condition(s).

.. _group_by:

GROUP BY
Expand All @@ -71,29 +92,12 @@ Group rows that have the same values in specified columns into summary rows.
SELECT column_1, SUM(column_2) FROM df GROUP BY column_1
.. _limit:

LIMIT
-----
Limit the number of rows returned by the query.

**Example:**

.. code-block:: sql
SELECT column_1, column_2 FROM df LIMIT 10
.. _offset:
.. _having:

OFFSET
HAVING
------
Skip a number of rows before starting to return rows from the query.
Filter groups in a `GROUP BY` based on specific condition(s).

**Example:**

.. code-block:: sql
SELECT column_1, column_2 FROM df LIMIT 10 OFFSET 5

.. _order_by:

Expand All @@ -107,28 +111,26 @@ Sort the query result based on one or more specified columns.
SELECT * FROM df ORDER BY column_1 ASC, column_2 DESC
.. _select:
.. _limit:

SELECT
------
Select the columns to be returned by the query.
LIMIT
-----
Limit the number of rows returned by the query.

**Example:**

.. code-block:: sql
SELECT column_1, column_2 FROM df;
SELECT column_1, column_2 FROM df LIMIT 10
.. _union:
.. _offset:

UNION
-----
Combine the result sets of two or more SELECT statements into a single result set.
OFFSET
------
Skip a number of rows before starting to return rows from the query.

**Example:**

.. code-block:: sql
SELECT name, city FROM df.customers
UNION
SELECT name, city FROM df.suppliers
SELECT column_1, column_2 FROM df LIMIT 10 OFFSET 5
29 changes: 28 additions & 1 deletion py-polars/docs/source/reference/sql/functions/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,50 @@ SQL Functions
=============


.. raw:: html

<style>
div.sd-card-body.docutils li.toctree-l1 > :first-child {display: none;}
</style>


.. grid::

.. grid-item-card::

**Aggregate**
^^^^^^^^^^^^^

.. toctree::
:maxdepth: 2

aggregate

.. grid-item-card::

**Array**
^^^^^^^^^

.. toctree::
:maxdepth: 2

array

.. grid-item-card::

**Conditional**
^^^^^^^^^^^^^^^

.. toctree::
:maxdepth: 2

conditional

.. grid-item-card::

**Mathematical**
^^^^^^^^^^^^^^^^

.. toctree::
:maxdepth: 2

Expand All @@ -37,24 +56,32 @@ SQL Functions

.. grid-item-card::

**String**
^^^^^^^^^^

.. toctree::
:maxdepth: 2

string

.. grid-item-card::

**Temporal**
^^^^^^^^^^^^

.. toctree::
:maxdepth: 2

temporal

.. grid-item-card::

**Trigonometry**
^^^^^^^^^^^^^^^^

.. toctree::
:maxdepth: 2

trigonometry

.. grid-item-card::

Loading

0 comments on commit 29e1888

Please sign in to comment.