使用查询来查找数据 [英] Using queries to find data
本文介绍了使用查询来查找数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么我们在查询数据库时使用符号''%?
Why we use the symbol ''%" when we query a database?
推荐答案
所有rdbms sql实现都提供了通配符。至少有两个:一个用于替换任何字符和一个替换任何字符序列 - 实际上用于简单的模式匹配。%
用于t-sql中的字符序列。请在此处查看更详细的说明:< a href =http://www.w3schools.com/sql/sql_wildcards.asp> http://www.w3schools.com/sql/sql_wildcards.asp [ ^ ]。
All rdbms sql implementations provide wildcard. At least two of them: one for substituting any character and one for substituting any character sequence - so actually for simple pattern matching. %
is for character sequences in t-sql. Look here for a more detailed explanation: http://www.w3schools.com/sql/sql_wildcards.asp[^].
这是SQL的等价物文件名中的Windows''''' - 表示匹配任何东西
所以在SQL中
It''s the SQL equivalent of Windows ''*'' in file names - it means "match anything"
So in SQL
SELECT * FROM MyTable WHERE userName LIKE '%fred%'
将匹配
will match
fred
freda
fred smith
john fredericks
但不是
But not
fre del
red adaire
哇!大量拼写错误... - OriginalGriff [/ edit]
[edit]Wow! Loads of typos... - OriginalGriff[/edit]
这篇关于使用查询来查找数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文