gpt4 book ai didi

mysql - SQL搜索类似,并按空格切割结果

转载 作者:太空宇宙 更新时间:2023-11-03 11:57:49 27 4
gpt4 key购买 nike

假设我有下表:

ID      City
1        New York
2        London
3        Yorkshire
4        West Yorkshire
5        North Yorkshire
6        Downyork

我如何从这个表 (id 1,3,4,5) 中获取每一行,其中包含一个以 York 开头的单词?

We can safely assume that each and every word is separated by a single space

如果我这样做

 SELECT * FROM table WHERE City LIKE '%York%'

id 为 6 的行也被返回。

最佳答案

SELECT * FROM table WHERE City LIKE '% York%' OR City LIKE 'York%'

关于mysql - SQL搜索类似,并按空格切割结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31343506/

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