如何在 MySQL STRCMP() 函数中将数值用作参数?
mysqlmysqli database更新于 2025/5/28 15:40:17
为了进行比较,我们可以在 STRCMP() 函数中使用数值作为参数。它们作为参数给出,不带引号。以下示例将对此进行演示。
示例
mysql> Select STRCMP(10,10)As 'Equal Numbers', STRCMP(11,10)AS '2nd Smaller', STRCMP(10,11)AS '1st Smaller', STRCMP(10,NULL)As '2nd NULL',STRCMP(NULL,10)AS '1st NULL',STRCMP(NULL,NULL)AS 'Both NULL'; +---------------+-------------+-------------+----------+----------+-----------+ | Equal Numbers | 2nd Smaller | 1st Smaller | 2nd NULL | 1st NULL | Both NULL | +---------------+-------------+-------------+----------+----------+-----------+ | 0 | 1 | -1 | NULL | NULL | NULL | +---------------+-------------+-------------+----------+----------+-----------+ 1 row in set (0.00 sec)
相关文章
有用资源
mysql 参考教程 - 该教程包含有关 mysql 的更多信息:https://www.cainiaomax.com/mysql/

