Home > Database > Mysql Tutorial > 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
Release: 2023-08-29 11:05:08
forward
865 people have browsed it

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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template