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

数据库数据库 2023-08-31 02:58:08 691
摘要: 示例mysql>CreatetabletestingSelectIFNULL(100,'testing123');QueryOK,1rowaffected(0.18sec)Records:1Duplicates:0Warnings:0mysql>Select*fromtesting568;+-------------------...

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

示例

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)

从上面的结果集中可以清楚地看出,在本例中,列的类型是 varchar(7)。也就是说,它是字符串类型。

以上就是MySQL IFNULL() 控制流运算符的默认返回类型是什么?的详细内容,更多请关注其它相关文章!