Create a table based on the result of IFNULL : IFNULL : Control Flow Functions MySQL TUTORIALS


MySQL TUTORIALS » Control Flow Functions » IFNULL »

 

Create a table based on the result of IFNULL


mysql>
mysql>
mysql> CREATE TABLE tmp SELECT IFNULL(1,'test') AS test;
Query OK, row affected (0.25 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql>
mysql> DESCRIBE tmp;
+-------+--------------+------+-----+---------+-------+
| Field | Type         | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| test  | varbinary(4| NO   |     |         |       |
+-------+--------------+------+-----+---------+-------+
row in set (0.14 sec)

mysql>
mysql> select from tmp;
+------+
| test |
+------+
1    |
+------+
row in set (0.02 sec)

mysql>
mysql> drop table tmp;
Query OK, rows affected (0.01 sec)

mysql>



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Control Flow Functions
» IFNULL