In fact, the default return type of IFNULL(expression 1, expression 2) is the more common type of the two expressions, in order STRING, REAL or INTEGER. It can be understood through the following example -
mysql> Create table testing Select IFNULL(100,'testing123'); Query OK, 1 row affected (0.18 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql> Select * from testing568; +-----------------------+ | IFNULL(100,'testing') | +-----------------------+ | 100 | +-----------------------+ 1 row in set (0.00 sec) mysql> Describe testing568; +-----------------------+------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------------+------------+------+-----+---------+-------+ | IFNULL(100,'testing') | varchar(7) | NO | | | | +-----------------------+------------+------+-----+---------+-------+ 1 row in set (0.03 sec)
From the above result set it is clear that in this case the type of column is varchar(7). That is, it is of type string.
The above is the detailed content of What is the default return type of the MySQL IFNULL() control flow operator?. For more information, please follow other related articles on the PHP Chinese website!