gpt4 book ai didi

amazon-web-services - "Where clause"在 AWS Athena 中不起作用

转载 作者:行者123 更新时间:2023-12-04 16:41:27 26 4
gpt4 key购买 nike

data sample

我使用 AWS Glue 控制台从 Athena 中的 S3 存储桶创建了一个表。您可以在上面的屏幕截图中看到相关部分。我混淆了列名,所以假设列名是 "a test column" .我想选择值为 的记录D 在那一栏中。我尝试运行的查询是:

SELECT 
*
FROM
table
WHERE
"a test column" = "D"

什么都没有返回。我也尝试使用 IS 而不是 = ,以及包围 D WHERE 中用单引号代替双引号条款:

-- Tried this
WHERE
"a test column" = 'D'

-- Tried this
WHERE
"a test column" IS "D"

-- Tried this
WHERE
"a test column" IS 'D'

没有任何作用。有人可以帮忙吗?谢谢你。

我得到的错误信息是

Mismatched input 'where' expecting (service: amazon athena; status code: 400; error code: invalid request exception; request id: 8f2f7c17-8832-4e34-8fb2-a78855e3c17d)

最佳答案

查询语法有问题。引用字符串值时使用单引号 ('),因为双引号引用表中的列名。

SELECT 
*
FROM
table
WHERE
"column_name" = 'D'

关于amazon-web-services - "Where clause"在 AWS Athena 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60042411/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com