為了進行比較,我們可以在 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 STRCMP() 函數中使用數值作為參數?的詳細內容。更多資訊請關注PHP中文網其他相關文章!