在pg中查找字符串位置可以使用POSITION
函数。在查询中,你可以使用以下语法:
SELECT POSITION('substring' IN 'string');
例如,如果你想要在字符串'Hello, World!'
中查找子字符串'World'
的位置,你可以这样写:
SELECT POSITION('World' IN 'Hello, World!');
这将返回子字符串'World'
在'Hello, World!'
中的起始位置。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: pg中怎么将时间戳转换为日期