Oracle SQL 使用 Like 作为通配符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10202763/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 15:23:01  来源:igfitidea点击:

Oracle SQL using Like for a wildcard

sqloracleselectwheresql-like

提问by toups

I know you can use LIKE for a select statement to search for a string and then use wildcards to match that string.. ex:

我知道您可以将 LIKE 用于选择语句来搜索字符串,然后使用通配符来匹配该字符串.. 例如:

Select * from table where first_name LIKE '%r%';

Select * from table where first_name LIKE '%r%';

Would return names such as robert, roland, craig, etc.

将返回诸如 robert、roland、craig 等名称。

I'm curious how you would search for an actual wildcard in the string such as the %:

我很好奇您将如何在字符串中搜索实际的通配符,例如 %:

Select * from table where values LIKE '% % %';

Select * from table where values LIKE '% % %';

(the middle % being what you would be looking for) (obviously this is not the correct way to do it which is why I'm asking).

(中间 % 是您要查找的内容)(显然这不是正确的方法,这就是我要问的原因)。

回答by joydesigner

Just LIKE '%%' will be even easier.

只是 LIKE '%%' 会更容易。