{"id":178,"date":"2013-07-19T04:53:20","date_gmt":"2013-07-19T04:53:20","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=178"},"modified":"2013-07-19T12:29:43","modified_gmt":"2013-07-19T12:29:43","slug":"checking-for-null-value-mysql","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/checking-for-null-value-mysql\/","title":{"rendered":"Checking for NULL Value MySQL"},"content":{"rendered":"<p>A NULL is a value for which comparison yields neither a true nor false result.NULL = NULL is not true. It&#8217;s not false either. The outcome of any comparison of one value to a NULL value is a NULL result. <\/p>\n<p>If you want to check a Column for NULL value then use the following query<\/p>\n<p><strong>Query1<\/strong><\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT IFNULL(ColName, '') AS Names\r\n  FROM TableName \r\n<\/pre>\n<p><strong>Query2<\/strong><\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT CASE WHEN ColName IS NULL\r\n            THEN ''\r\n            ELSE ColName\r\n       END AS TableName \r\nFROM Test\r\n<\/pre>\n<p><strong>Query3<\/strong><\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\n SELECT COALESCE(ColName, 0) as 'ColName' FROM TableName;\r\n<\/pre>\n<p><strong>Query4<\/strong><\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\n SELECT IF(ColName IS NULL, '', ColName)\r\n   FROM TableName \r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A NULL is a value for which comparison yields neither a true nor false result.NULL = NULL is not true. It&#8217;s not false either. The outcome of any comparison of one value to a NULL value is a NULL result. If you want to check a Column for NULL value then use the following query&hellip; <a href=\"https:\/\/codethataint.com\/blog\/checking-for-null-value-mysql\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-178","post","type-post","status-publish","format-standard","hentry","category-queries-mysql"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/178","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=178"}],"version-history":[{"count":3,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/178\/revisions"}],"predecessor-version":[{"id":180,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/178\/revisions\/180"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}