- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What would be the default return type of MySQL IFNULL() control flow operator?
Actually, the default return type of IFNULL(expression1, expression2) is more general of the two expressions, in the order STRING, REAL or INTEGER. It can be understood from 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 the column is varchar(7). In other words, it is of string type.
Advertisements