sql 如何将值与SQL进行比较?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 如何将值与SQL进行比较?相关的知识,希望对你有一定的参考价值。
-----------------------------Vertica--------------------------------------------------------------------
select
greatest(5.5, 8.2, -8.2) as HighestValue, -- returns the higer number, taking the sign into account
least(5.5, 8.2, -8.2) as LowestValue -- returns the lower number, taking the sign into account
-----------------------------MySQL----------------------------------------------------------------------
select
greatest(5.5, 8.2, -8.2) as HighestValue, -- returns the higer number, taking the sign into account
least(5.5, 8.2, -8.2) as LowestValue -- returns the lower number, taking the sign into account
HighestValue |LowestValue |
-------------|------------|
8.2 |-8.2 |
-----------------------------PostgreSQL--------------------------------------------------------------------
select
greatest(5.5, 8.2, -8.2) as HighestValue, -- returns the higer number, taking the sign into account
least(5.5, 8.2, -8.2) as LowestValue -- returns the lower number, taking the sign into account
highestvalue |lowestvalue |
-------------|------------|
8.2 |-8.2 |
----------------------------SQL Server---------------------------------------------------------------------
select
max(MyValue) as HighestValue, -- returns the higer number, taking the sign into account
min(MyValue) as LowestValue -- returns the lower number, taking the sign into account
from (values (5.5), (8.2), (-8.2)) as a(MyValue)
HighestValue |LowestValue |
-------------|------------|
8.2 |-8.2 |
以上是关于sql 如何将值与SQL进行比较?的主要内容,如果未能解决你的问题,请参考以下文章