如果我使用整数值作为 MySQL LOCATE() 函数的参数,会发生什么?
MySQL 允许我们使用整数值作为 LOCATE() 函数的参数。无需使用引号。可通过以下示例进行演示 −
示例
mysql> Select LOCATE(5,1698235); +-------------------+ | LOCATE(5,1698235) | +-------------------+ | 7 | +-------------------+ 1 row in set (0.00 sec) mysql> Select LOCATE(56,1698235); +--------------------+ | LOCATE(56,1698235) | +--------------------+ | 0 | +--------------------+ 1 row in set (0.00 sec) mysql> Select LOCATE(23,1698235); +--------------------+ | LOCATE(23,1698235) | +--------------------+ | 5 | +--------------------+ 1 row in set (0.00 sec)
广告