Home > Database > Mysql Tutorial > How to use numeric values ​​as parameters in MySQL STRCMP() function?

How to use numeric values ​​as parameters in MySQL STRCMP() function?

WBOY
Release: 2023-09-09 17:29:02
forward
978 people have browsed it

如何在 MySQL STRCMP() 函数中使用数值作为参数?

For comparison, we can use numeric values ​​as arguments in the STRCMP() function. They are given as arguments without quotes. The following example demonstrates this.

Example

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)
Copy after login

The above is the detailed content of How to use numeric values ​​as parameters in MySQL STRCMP() function?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template