Home  >  Article  >  Database  >  What is the default return type of the MySQL IFNULL() control flow operator?

What is the default return type of the MySQL IFNULL() control flow operator?

WBOY
WBOYforward
2023-08-29 11:05:08835browse

MySQL IFNULL() 控制流运算符的默认返回类型是什么?

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 -

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete