You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在AWS Athena查询编辑器中添加注释行

在AWS Athena查询编辑器中添加注释行的方法

Athena基于Presto SQL语法,支持两种常用的注释方式:

单行注释

用--开头,后面紧跟注释内容,注释会从--开始到该行末尾生效:

-- 筛选2024年的有效订单数据
SELECT order_id, customer_id, total_amount
FROM orders
WHERE order_date >= '2024-01-01' AND order_status = 'valid';

多行注释

用/*作为开头标记,*/作为结尾标记,中间内容可以跨越多行:

/*
该查询用于统计各地区的月度订单总量
统计范围:2024年1月至6月
排除测试订单和无效订单
*/
SELECT region, month(order_date) AS month, COUNT(order_id) AS order_count
FROM orders
WHERE order_date BETWEEN '2024-01-01' AND '2024-06-30'
  AND order_status NOT IN ('test', 'invalid')
GROUP BY region, month(order_date);

这两种注释方式在Athena查询编辑器中都能被正确识别,注释内容不会被执行。

内容的提问来源于stack exchange,提问作者Prageeth godage

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 14:30:16