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进行比较?的主要内容,如果未能解决你的问题,请参考以下文章

如何将html输入的值与sql数据库的值进行比较

SQL WHERE 子句将值与尾随空格匹配

如何将列的当前值与sql server和Oracle中同一列的先前值进行比较

将值与数组元素进行比较

将值与可能较大的数据集进行比较

使用 StartsWith 将值与字符串数组进行比较