如果我将整数值用作 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)
广告