@@ -4,63 +4,69 @@ sidebar_label: Alternative Query Languages
44title : Alternative Query Languages
55description : Use alternative query languages in ClickHouse
66---
7+ import ExperimentalBadge from '@theme/badges /ExperimentalBadge';
78
8- You can use other query languages to query data in ClickHouse using the ` dialect ` setting.
9- After changing ` dialect ` , you can run queries in the newly configured dialect.
9+ Besides standard SQL, ClickHouse supports various alternative query languages for querying data.
1010
1111The currently supported dialects are:
12- - ` clickhouse ` : The default [ ClickHouse SQL dialect] ( ../../sql-reference/syntax.md )
13-
14- Experimental dialects:
15- - ` prql ` : [ Pipelined Relational Query Language] ( https://prql-lang.org/ )
12+ - ` clickhouse ` : The default [ SQL dialect] ( ../../sql-reference/syntax.md ) of ClickHouse
13+ - ` prql ` : [ Pipelined Relational Query Language (PRQL)] ( https://prql-lang.org/ )
1614- ` kusto ` : [ Kusto Query Language (KQL)] ( https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query )
1715
18- ### ClickHouse SQL
16+ Which query language is used is controlled by setting ` dialect ` .
17+
18+ ### Standard SQL
1919
20- The default SQL dialect for ClickHouse.
20+ Standard SQL is the default query language of ClickHouse.
2121
2222``` sql
2323SET dialect = ' clickhouse'
2424```
2525
26- ## Experimental Dialects
26+ ## Pipelined Relational Query Language (PRQL)
2727
28- These dialects may not be fully supported or have all of the features of their original specification.
28+ < ExperimentalBadge />
2929
30- ### Pipelined Relational Query Language ( PRQL)
30+ To enable PRQL:
3131
32- You can execute queries using the PRQL language after setting the dialect to ` prql ` :
3332``` sql
33+ SET allow_experimental_prql_dialect = 1 ;
3434SET dialect = ' prql'
3535```
3636
37- Then you can use every PRQL feature that the included compiler supports:
37+ Example PRQL query:
38+
3839
3940``` prql
4041from trips
4142aggregate {
4243 ct = count this
43- total_days = sum days
44+ total_days = sum days
4445}
4546```
4647
47- Under the hood ClickHouse will translate the PRQL query into an SQL query and execute it .
48+ Under the hood, ClickHouse uses transpilaton from PRQL to SQL to run PRQL queries .
4849
4950### Kusto Query Language (KQL)
5051
51- Kusto may not be able to access all functions defined in ClickHouse.
52+ <ExperimentalBadge />
53+
54+ To enable KQL:
5255
53- Enable Kusto:
5456``` sql
57+ SET allow_experimental_kusto_dialect = 1 ;
5558SET dialect = ' kusto'
5659```
5760
58- Example query that selects from ` system.numbers(10) ` :
59- ``` sql
61+ Example KQL query:
62+
63+ ``` kql
6064numbers(10) | project number
6165```
6266
63- ``` sql
67+ Result:
68+
69+ ```
6470┌─number─┐
6571│ 0 │
6672│ 1 │
@@ -75,3 +81,4 @@ numbers(10) | project number
7581└────────┘
7682```
7783
84+ Note that KQL queries may not be able to access all functions defined in ClickHouse.
0 commit comments