在SQL中的位置和喜欢 [英] where and Like in sql

查看:69
本文介绍了在SQL中的位置和喜欢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友
我的语言是波斯文(伊朗文)
我在sql server 2088中写此查询:

hi friends
my language is Persian (IRANIAN)
i write this query in sql server 2088 :

select * from Table1 where Name Like ''%unique-char%''


但结果是0行
请引导我输入唯一字符


but result is 0 rows
please guide me for unique characters

推荐答案

首先,您需要了解Like关键字在SQL中的用途.
LIKE关键字可帮助您在SQL/Oracle等中应用通配符搜索.如果要查找名称以P开头的所有学生,则查询为:
First of all you need to understand the purpose of Like keyword in SQL.
LIKE keyword helps you apply wildcard search in SQL/Oracle etc. e.g. If you want to find all the students for which name starts with P then query would be :
SELECT * FROM Students WHERE Name LIKE ''P%''



您可以在 MSDN Like关键字 [网上技术 [ ^ ]

回到您的问题:
从查询中可以明显看出,您希望列出Name包含字符串"unique-char"的所有行.之所以得到0行,是因为可能没有名称包含字符串"unique-char"的行.尝试缩小搜索范围.例如



You can find a lots of examples at MSDN Like Keyword[^] also at Tech on the net[^]

Coming back to your question :
From your query it is evident that you want to list all the rows for which Name contains the string "unique-char". The reason that you are getting 0 rows, is there may be no row for which name contains the string "unique-char". Try to narrow the search. e.g

select * from Table1 where Name Like ''u%''


select * from Table1 where Name Like ''%char%''



希望对您有帮助.
一切顺利.

etc.

Hope this helps you.
All the best.


我认为您的查询是正确的.

任何喜欢这样的人

从表中选择*,其中%char%"之类的字段

我希望这对您有用
i think your query is correct.

any do like this

select * from Table where field like ''%char%''

i hope this is useful to you


这篇关于在SQL中的位置和喜欢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆