In database, sometimes we have to insert the record with some NULL values. But at the time of displaying the data to the user, it doesn't make sense to display NULL values. In order to make the data more readable, we have to display values such as unknown, missing or not available (N/A) instead of NULL values. In MySQL, we use a function IF(). Syntax of IF() function is as follows:
IF(exp,exp_result1,exp_result2)
If the 'exp' returns TRUE, the IF function returns the value of the exp_result1 otherwise it returns the value of exp_result2.
0 Comment(s)