时间:2021-07-01 10:21:17 帮助过:12人阅读
比较两个字符串,如果这两个字符串相等返回0,如果第一个参数是根据当前的排序小于第二个参数顺序返回-1,否则返回1。
mysql> SELECT STRCMP(‘MOHD‘, ‘MOHD‘); +---------------------------------------------------------+ | STRCMP(‘MOHD‘, ‘MOHD‘) | +---------------------------------------------------------+ | 0 | +---------------------------------------------------------+ 1 row in set (0.00 sec)
另一个例子是:
mysql> SELECT STRCMP(‘AMOHD‘, ‘MOHD‘); +---------------------------------------------------------+ | STRCMP(‘AMOHD‘, ‘MOHD‘) | +---------------------------------------------------------+ | -1 | +---------------------------------------------------------+ 1 row in set (0.00 sec)
让我们来看看一个例子:
mysql> SELECT STRCMP(‘MOHD‘, ‘AMOHD‘); +---------------------------------------------------------+ | STRCMP(‘MOHD‘, ‘AMOHD‘) | +---------------------------------------------------------+ | 1 | +---------------------------------------------------------+ 1 row in set (0.00 sec)
MySQL strcmp 函数
标签:0.00 select 字符串 根据 blog 相等 pre 参数顺序 参数