-- 1、方式一
select country_nm
from dw_pub_country_td
where country_nm = 'Lao People''s Democratic Republic'
-- 2、方式二
select country_nm
from dw_pub_country_td
where country_nm = "Lao People's Democratic Republic"
- Presto:方式一可行,方式二会报错
- Hive:方式二可行,方式一不报错但是查询为空
- Mysql:方式一二皆可

本文探讨了在不同数据库中使用特殊字符进行SQL查询时的字符串转义问题,对比了Presto、Hive和Mysql三种数据库对字符串转义符的不同处理方式。在Presto中,单引号内的字符串需使用两个单引号进行转义;而在Hive中,双引号内的字符串则不需要额外转义。Mysql则同时支持单引号和双引号转义。
8154





