Using IF with float point value : IF « Control Flow Functions « MySQL Tutorial






mysql>
mysql>
mysql> SELECT IF(0.1,1,0);
+-------------+
| IF(0.1,1,0) |
+-------------+
|           1 |
+-------------+
1 row in set (0.00 sec)

mysql>
mysql> SELECT IF(0.1<>0,1,0);
+----------------+
| IF(0.1<>0,1,0) |
+----------------+
|              1 |
+----------------+
1 row in set (0.00 sec)

mysql>








18.3.IF
18.3.1.IF(expr1,expr2,expr3)
18.3.2.Using string comparison function with IF
18.3.3.Using IF with float point value
18.3.4.Use IF with data in a table
18.3.5.Using IF in where clause
18.3.6.Using IF() function to compare numbers
18.3.7.A number can also be returned from IF() function
18.3.8.Use and IF() and COUNT() to give us a total as COUNT() ignores NULL values