Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Tip: Understanding Null Values Returned in MySQL

Learn why the null value often needs special attention in your code to work effectively.


advertisement

The null value often needs special attention in your code to work effectively.

For developers, it is important to know if the value that was received for a query is null or not. However, different programming languages handle the return of null values differently. With MySQL, it becomes easier as you can tell what to return in case of null and not null. This makes your programming logic easier, better and more effective.

SELECT ISNULL(column_name) FROM `database_name`.`table_name`;

Here, ISNULL will populate the column value with 0 if the value is null and with 1 if the value is not null. Based on this, we can handle null cases effectively in our code.

 

Visit the DevX Tip Bank

 





   
Sridhar M S. is a Java developer from Bangalore, India. He holds a master's degree in Computer Science.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date