{"id":2372,"date":"2013-05-14T22:23:53","date_gmt":"2013-05-15T06:23:53","guid":{"rendered":"http:\/\/www.mysqltutorial.org\/?page_id=2372"},"modified":"2020-04-11T02:02:20","modified_gmt":"2020-04-11T09:02:20","slug":"mysql-ifnull","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-control-flow-functions\/mysql-ifnull\/","title":{"rendered":"MySQL IFNULL"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn about the <strong>MySQL IFNULL<\/strong> function, which is a very handy control flow function to handle NULL values.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction to MySQL IFNULL function<\/h2>\n\n\n\n<p>MySQL <code>IFNULL<\/code> function is one of the MySQL control flow functions that accepts two arguments and returns the first argument if it is not <code>NULL<\/code>. Otherwise, the <code>IFNULL<\/code> function returns the second argument.<\/p>\n\n\n\n<p>The two arguments can be literal values or expressions.<\/p>\n\n\n\n<p>The following illustrates the syntax of the <code>IFNULL<\/code> function:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">IFNULL(expression_1,expression_2);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>IFNULL<\/code> function returns <code>expression_1<\/code> if <code>expression_1<\/code> is not <code>NULL<\/code> ; otherwise, it returns <code>expression_2<\/code>. The<\/p>\n\n\n\n<p>The <code>IFNULL<\/code> function returns a string or a numeric based on the context where it is used.<\/p>\n\n\n\n<p>If you want to return a value based on <code>TRUE<\/code> or <code>FALSE<\/code> condition other than <code>NULL<\/code>, you should use the <a title=\"MySQL IF Function\" href=\"https:\/\/www.mysqltutorial.org\/mysql-control-flow-functions\/mysql-if-function\/\">IF function<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">MySQL IFNULL function examples<\/h2>\n\n\n\n<p>See the following <code>IFNULL<\/code> function examples:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> <span class=\"hljs-keyword\">IFNULL<\/span>(<span class=\"hljs-number\">1<\/span>,<span class=\"hljs-number\">0<\/span>); <span class=\"hljs-comment\">-- returns 1<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a class=\"sql\" href=\"https:\/\/www.mysqltutorial.org\/tryit\/query\/mysql-ifnull\/#1\" target=\"_blank\" rel=\"noopener noreferrer\">Try It Out<\/a><\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> <span class=\"hljs-keyword\">IFNULL<\/span>(<span class=\"hljs-string\">''<\/span>,<span class=\"hljs-number\">1<\/span>); <span class=\"hljs-comment\">-- returns ''<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a class=\"sql\" href=\"https:\/\/www.mysqltutorial.org\/tryit\/query\/mysql-ifnull\/#2\" target=\"_blank\" rel=\"noopener noreferrer\">Try It Out<\/a><\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> <span class=\"hljs-keyword\">IFNULL<\/span>(<span class=\"hljs-literal\">NULL<\/span>,<span class=\"hljs-string\">'IFNULL function'<\/span>); <span class=\"hljs-comment\">-- returns IFNULL function<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a class=\"sql\" href=\"https:\/\/www.mysqltutorial.org\/tryit\/query\/mysql-ifnull\/#3\" target=\"_blank\" rel=\"noopener noreferrer\">Try It Out<\/a><\/p>\n\n\n\n<p>How it works.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><span style=\"line-height: 13px;\"> <code>IFNULL(1,0)<\/code> returns 1 because 1 is not <code>NULL<\/code> .<\/span><\/li><li><code>IFNULL(' ',1)<\/code> returns <code>' '<\/code> because the <code>' '<\/code> string is not <code>NULL<\/code> .<\/li><li><code>IFNULL(NULL,'IFNULL function')<\/code> returns <code>IFNULL function<\/code> string because the first argument is <code>NULL<\/code>.<\/li><\/ul>\n\n\n\n<p>Let&#8217;s take a practical example of using the <code>IFNULL<\/code> function.<\/p>\n\n\n\n<p>First, <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-create-table\/\">create a new table<\/a> named <code>contacts<\/code> using the following statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> <span class=\"hljs-keyword\">IF<\/span> <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-keyword\">EXISTS<\/span> contacts (\n    contactid <span class=\"hljs-built_in\">INT<\/span> AUTO_INCREMENT PRIMARY <span class=\"hljs-keyword\">KEY<\/span>,\n    contactname <span class=\"hljs-built_in\">VARCHAR<\/span>(<span class=\"hljs-number\">20<\/span>) <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-literal\">NULL<\/span>,\n    bizphone <span class=\"hljs-built_in\">VARCHAR<\/span>(<span class=\"hljs-number\">15<\/span>),\n    homephone <span class=\"hljs-built_in\">VARCHAR<\/span>(<span class=\"hljs-number\">15<\/span>)\n);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Each contact has a name, business phone and home phone.<\/p>\n\n\n\n<p>Second, <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert\/\">insert data<\/a> into the <code>contacts<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">INSERT<\/span> <span class=\"hljs-keyword\">INTO<\/span> contacts(contactname,bizphone,homephone)\n<span class=\"hljs-keyword\">VALUES<\/span>(<span class=\"hljs-string\">'John Doe'<\/span>,<span class=\"hljs-string\">'(541) 754-3009'<\/span>,<span class=\"hljs-literal\">NULL<\/span>),\n      (<span class=\"hljs-string\">'Cindy Smith'<\/span>,<span class=\"hljs-literal\">NULL<\/span>,<span class=\"hljs-string\">'(541) 754-3110'<\/span>),\n      (<span class=\"hljs-string\">'Sue Greenspan'<\/span>,<span class=\"hljs-string\">'(541) 754-3010'<\/span>,<span class=\"hljs-string\">'(541) 754-3011'<\/span>),\n      (<span class=\"hljs-string\">'Lily Bush'<\/span>,<span class=\"hljs-literal\">NULL<\/span>,<span class=\"hljs-string\">'(541) 754-3111'<\/span>);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Some contacts have only home phone or business phone. To get all the contact name and phone from the <code>contacts<\/code> table, you use the following query:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    contactName, bizphone, homephone\n<span class=\"hljs-keyword\">FROM<\/span>\n    contacts;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a class=\"sql\" href=\"https:\/\/www.mysqltutorial.org\/tryit\/query\/mysql-ifnull\/#4\" target=\"_blank\" rel=\"noopener noreferrer\">Try It Out<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"301\" height=\"110\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-IFNULL-function-example.jpg\" alt=\"MySQL IFNULL function example\" class=\"wp-image-4599\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-IFNULL-function-example.jpg 301w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-IFNULL-function-example-300x110.jpg 300w\" sizes=\"auto, (max-width: 301px) 100vw, 301px\" \/><\/figure>\n\n\n\n<p>It would be nice if we can get the contact&#8217;s home phone if the contact&#8217;s business phone is not available. This is where the<\/p>\n\n\n\n<p>This is where the <code>IFNULL<\/code> function comes to play. The <code>IFNULL<\/code> function returns the home phone if the business phone is <code>NULL<\/code>.<\/p>\n\n\n\n<p>Third, use the following query to get the names and phones of all the contacts:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    contactname, <span class=\"hljs-keyword\">IFNULL<\/span>(bizphone, homephone) phone\n<span class=\"hljs-keyword\">FROM<\/span>\n    contacts;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a class=\"sql\" href=\"https:\/\/www.mysqltutorial.org\/tryit\/query\/mysql-ifnull\/#5\" target=\"_blank\" rel=\"noopener noreferrer\">Try It Out<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"208\" height=\"111\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-IFNULL-result.jpg\" alt=\"MySQL IFNULL result\" class=\"wp-image-4600\"\/><\/figure>\n\n\n\n<p>Notice that you should avoid using the <code>IFNULL<\/code> function in the <a title=\"MySQL WHERE\" href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-where\/\">WHERE clause<\/a>, because it degrades the performance of the query. If you want to check if a value is<\/p>\n\n\n\n<p>If you want to check if a value is <code>NULL<\/code> or not, you can use <code>IS NULL<\/code> or <code>IS NOT NULL<\/code> in the <code>WHERE<\/code> clause.<\/p>\n\n\n\n<p>In this tutorial, we have introduced you to MySQL <code>IFNULL<\/code> function and shown you how to use the <code>IFNULL<\/code> function in the queries.<\/p>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful? <\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"2372\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-control-flow-functions\/mysql-ifnull\/\"\n\t\t\t\tdata-post-title=\"MySQL IFNULL\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"2372\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-control-flow-functions\/mysql-ifnull\/\"\n\t\t\t\tdata-post-title=\"MySQL IFNULL\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial introduces you to MySQL IFNULL function and shows you how to use the IFNULL function in the queries.<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":7030,"menu_order":2,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-2372","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MySQL IFNULL - Practical Examples of IFNULL Function<\/title>\n<meta name=\"description\" content=\"This tutorial shows you how to use MySQL IFNULL function to handle NULL values more efficiently.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mysqltutorial.org\/mysql-ifnull\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL IFNULL - Practical Examples of IFNULL Function\" \/>\n<meta property=\"og:description\" content=\"This tutorial shows you how to use MySQL IFNULL function to handle NULL values more efficiently.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-ifnull\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2020-04-11T09:02:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-IFNULL-function-example.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-ifnull\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-ifnull\\\/\",\"name\":\"MySQL IFNULL - Practical Examples of IFNULL Function\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-ifnull\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-ifnull\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2013\\\/05\\\/MySQL-IFNULL-function-example.jpg\",\"datePublished\":\"2013-05-15T06:23:53+00:00\",\"dateModified\":\"2020-04-11T09:02:20+00:00\",\"description\":\"This tutorial shows you how to use MySQL IFNULL function to handle NULL values more efficiently.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-ifnull\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-ifnull\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-ifnull\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2013\\\/05\\\/MySQL-IFNULL-function-example.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2013\\\/05\\\/MySQL-IFNULL-function-example.jpg\",\"width\":301,\"height\":110,\"caption\":\"MySQL IFNULL function example\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-ifnull\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL Control Flow Functions and Expressions\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-control-flow-functions\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"MySQL IFNULL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\",\"name\":\"MySQL Tutorial\",\"description\":\"A comprehensive MySQL Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mysqltutorial.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL IFNULL - Practical Examples of IFNULL Function","description":"This tutorial shows you how to use MySQL IFNULL function to handle NULL values more efficiently.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mysqltutorial.org\/mysql-ifnull\/","og_locale":"en_US","og_type":"article","og_title":"MySQL IFNULL - Practical Examples of IFNULL Function","og_description":"This tutorial shows you how to use MySQL IFNULL function to handle NULL values more efficiently.","og_url":"https:\/\/www.mysqltutorial.org\/mysql-ifnull\/","og_site_name":"MySQL Tutorial","article_modified_time":"2020-04-11T09:02:20+00:00","og_image":[{"url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-IFNULL-function-example.jpg","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-ifnull\/","url":"https:\/\/www.mysqltutorial.org\/mysql-ifnull\/","name":"MySQL IFNULL - Practical Examples of IFNULL Function","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-ifnull\/#primaryimage"},"image":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-ifnull\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-IFNULL-function-example.jpg","datePublished":"2013-05-15T06:23:53+00:00","dateModified":"2020-04-11T09:02:20+00:00","description":"This tutorial shows you how to use MySQL IFNULL function to handle NULL values more efficiently.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-ifnull\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-ifnull\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mysqltutorial.org\/mysql-ifnull\/#primaryimage","url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-IFNULL-function-example.jpg","contentUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-IFNULL-function-example.jpg","width":301,"height":110,"caption":"MySQL IFNULL function example"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-ifnull\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"MySQL Control Flow Functions and Expressions","item":"https:\/\/www.mysqltutorial.org\/mysql-control-flow-functions\/"},{"@type":"ListItem","position":3,"name":"MySQL IFNULL"}]},{"@type":"WebSite","@id":"https:\/\/www.mysqltutorial.org\/#website","url":"https:\/\/www.mysqltutorial.org\/","name":"MySQL Tutorial","description":"A comprehensive MySQL Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mysqltutorial.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/2372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/comments?post=2372"}],"version-history":[{"count":0,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/2372\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/7030"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=2372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}