SQL Server中Max和Min函数之间的区别 [英] Difference Between Max and Min function in sql server

查看:284
本文介绍了SQL Server中Max和Min函数之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



sql server/Oracle/My sql any Database中Max和Min函数之间的区别是什么?

问候,
Sunil r nair

Hi,

What is Difference Between Max and Min function in sql server/Oracle/My sql any Database ?

Regards,
Sunil r nair

推荐答案

MAX:返回表达式中的最大值.可能后跟OVER子句.
MIN:返回表达式中的最小值.可能后跟OVER子句.

详细信息在这里:
MSDN:MAX(Transact-SQL) [ MSDN:MIN(Transact-SQL) [
MAX: Returns the maximum value in the expression. May be followed by the OVER clause.
MIN: Returns the minimum value in the expression. May be followed by the OVER clause.

Details here:
MSDN: MAX (Transact-SQL)[^]
MSDN: MIN (Transact-SQL)[^]


示例:

拿桌子tbstudent

罗尔诺学生名类科目
1 abc 1st eng
2 def 2nd hin
3 ijk 3rd数学
4 lmn第四科学
5


"''''代表max
从tbstudent中选择max(rollno)

''''分钟

从tbstudent中选择min(rollno)
example :

take table tbstudent

rollno studentname class subject
1 abc 1st eng
2 def 2nd hin
3 ijk 3rd math
4 lmn 4th science
5


'''''' for max
select max(rollno) from tbstudent

'''' for min

select min(rollno) from tbstudent


如果您想问问它们在不同产品之间的区别,它们通常没有区别. MIN和MAX均由ANSI标准定义,因此不同的产品非常精确地遵循该标准.

当然,内部实现会发生变化,但这对调用者而言是不可见的.
If you mean to ask how they differ between different products, they typically don''t. Both MIN and MAX are defined by ANSI standard so different products follow the standard quite precisly.

Of course, the internal implementation changes, but that''s not visible to the caller.


这篇关于SQL Server中Max和Min函数之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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