SQL Server select-where 语句问题
我在 Windows Server 2008 Enterprise 上使用 SQL Server 2008 Enterprise。我有一个关于 SQL Server 2008 中 tsql 的问题。对于 select-where 语句,有两种不同的形式,
(1) select where foo [some value] 和 [some other value] 之间,
(2) select where foo >= [某个值] 和 foo <= [某个其他值]?我不确定 Between-and 是否始终与使用 <= 和 >= 符号相同?
顺便说一句:它们是否始终相同 - 即使对于不同类型的数据(例如比较数值,比较字符串值),如果有人可以提供一些文档来证明它们是否始终相同,以便我可以从中了解更多信息。
提前致谢, 乔治
I am using SQL Server 2008 Enterprise on Windows Server 2008 Enterprise. I have a question about tsql in SQL Server 2008. For select-where statement, there are two differnet forms,
(1) select where foo between [some value] and [some other value],
(2) select where foo >= [some value] and foo <= [some other value]? I am not sure whether between-and is always the same as using <= and >= sign?
BTW: whether they are always the same - even for differnet types of data (e.g. compare numeric value, comparing string values), appreciate if anyone could provide some documents to prove whether they are always the same, so that I can learn more from it.
thanks in advance,
George
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,它们总是一样的。 联机丛书中的条目
BETWEEN
说事实上,通过查看执行计划,您可以轻松地看到这一点。您会看到
Between
甚至没有出现在文本中。它已被替换为>=
和<=
,两者之间没有区别。Yes they are always the same. The entry in Books Online for
BETWEEN
saysIndeed you can see this easily by looking at the execution plans. You will see that
Between
doesn't even appear in the text. It has been replaced with>=
and<=
there is no distinction made between the two.