presto 语法
时间: 2023-08-03 14:20:25 浏览: 334
trino-query-formatter:Presto SQL查询格式化程序
Presto是一个分布式SQL查询引擎,支持标准的SQL查询语法。以下是一些常见的Presto语法:
1. 查询语句:
```
SELECT column1, column2, ...
FROM table_name
WHERE condition1 AND condition2 ...
```
2. 聚合函数:
```
SELECT COUNT(*), SUM(column_name), AVG(column_name)
FROM table_name
```
3. JOIN:
```
SELECT column_name(s)
FROM table1
JOIN table2
ON table1.column_name = table2.column_name
```
4. 子查询:
```
SELECT column_name(s)
FROM table_name
WHERE column_name IN (SELECT column_name FROM table_name WHERE condition)
```
5. CASE语句:
```
SELECT column_name,
CASE
WHEN condition THEN 'value'
WHEN condition THEN 'value'
ELSE 'value'
END
FROM table_name
```
以上是一些常见的Presto语法,更多语法可以参考Presto官方文档。
阅读全文