{"id":106317,"date":"2021-12-16T11:00:00","date_gmt":"2021-12-16T09:00:00","guid":{"rendered":"https:\/\/examples.javacodegeeks.com\/?p=106317"},"modified":"2021-12-15T16:59:17","modified_gmt":"2021-12-15T14:59:17","slug":"sql-if-statement-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/","title":{"rendered":"SQL IF Statement Example"},"content":{"rendered":"<h2 class=\"wp-block-heading\" id=\"h-1-introduction\">1. Introduction<\/h2>\n<p>Structured Query Language (SQL) supports the <strong>IF <\/strong>statement like any other programming language. The <strong>IF<\/strong> statement tests a <strong>boolean<\/strong> expression. If the expression is <strong>true<\/strong>, then the block of statements associated with the <strong>IF<\/strong> statement is executed. It can also be used with an <strong>ELSE <\/strong>statement;<\/p>\n<p>In this example, I will demonstrate how to:<\/p>\n<ul class=\"wp-block-list\">\n<li>Use the <strong>IF <\/strong>function in a <strong>Select <\/strong>statement.<\/li>\n<li>Create a stored procedure with nested <strong>IF <\/strong>statements.<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"h-2-technologies-used\">2. Technologies Used<\/h2>\n<p>The example code in this article was built and run using:<\/p>\n<ul class=\"wp-block-list\">\n<li>MySQL<\/li>\n<li>SQL<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"h-3-if-function\">3. IF Function<\/h2>\n<p>The <strong>IF<\/strong>() function takes three arguments: <\/p>\n<ul class=\"wp-block-list\">\n<li>The first is a <strong>boolean<\/strong> expression which evaluates to either <strong>true<\/strong> or <strong>false<\/strong>. <\/li>\n<li>The second argument is the value to be returned when the expression is <strong>true<\/strong>. <\/li>\n<li>The third argument is the value returned when the expression is <strong>false<\/strong>.<\/li>\n<\/ul>\n<p><span style=\"text-decoration: underline\"><em>IF Function Syntax<\/em><\/span> <\/p>\n<pre class=\"wp-block-preformatted brush:sql\">IF(expression, true_value, false_value);<\/pre>\n<p>In these two examples, the first example evaluates to <strong>true<\/strong> and returns the second value.  The second example evaluates to <strong>false<\/strong> and returns the third value.<\/p>\n<p><span style=\"text-decoration: underline\"><em>IF in Select<\/em><\/span>\n<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">mysql&gt; SELECT IF(500&lt;1000, \"500 is less than 1000\", \"NA\") \/\/\n+---------------------------------------------+\n| IF(500&lt;1000, \"500 is less than 1000\", \"NA\") |\n+---------------------------------------------+\n| 500 is less than 1000                       |\n+---------------------------------------------+\n1 row in set (0.00 sec)\n\nmysql&gt; SELECT IF(500&gt;1000, \"\", \"500 is less than 1000\") \/\/\n+-------------------------------------------+\n| IF(500&gt;1000, \"\", \"500 is less than 1000\") |\n+-------------------------------------------+\n| 500 is less than 1000                     |\n+-------------------------------------------+\n1 row in set (0.00 sec)\n\nmysql&gt;<\/pre>\n<h2 class=\"wp-block-heading\" id=\"h-4-sql-if-statement\">4. SQL IF Statement<\/h2>\n<p>The SQL <strong>IF<\/strong> statement is very similar to the <strong>IF<\/strong> function, as it branches out the execution statements.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><span style=\"text-decoration: underline\"><em>IF Statement Syntax<\/em><\/span>\n<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">IF (Expression which evaluates to either true OR false )\n  BEGIN\n    -- If the condition is TRUE\n  END\nELSE\n  BEGIN\n    -- If the condition is False\n  END\nEND IF<\/pre>\n<p><strong>Note<\/strong>: the <strong>else<\/strong> branch is optional.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-4-1-set-up-simple-data\">4.1 Set up Simple Data<\/h3>\n<p>In this step, I will create a table named with <strong>demo_table<\/strong> and insert three records.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Create a Table with Data<\/em><\/span>\n<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">create table demo_table(\n   id INT NOT NULL AUTO_INCREMENT,\n   name VARCHAR(100) NOT NULL,\n   direction INT NOT NULL,\n   PRIMARY KEY ( id )\n);\n\ninsert into demo_table(name, direction) values('mary',1);\ninsert into demo_table(name, direction) values('shan',2);\ninsert into demo_table(name, direction) values('zheng',3);<\/pre>\n<h3 class=\"wp-block-heading\" id=\"h-4-2-create-a-stored-procedure\">4.2 Create a Stored Procedure<\/h3>\n<p>In this step, I will create a stored procedure called <strong>demoIf<\/strong> which takes a single input argument <strong>type<\/strong>. <\/p>\n<p>If the input <strong>type<\/strong> is <strong>&#8220;P&#8221;<\/strong>, then executes a <strong>Select<\/strong> statement which prints out the data from <strong>demo_table<\/strong> and translates the <strong>direction<\/strong> column. If the input <strong>type<\/strong> is <strong>&#8220;A&#8221;<\/strong>, then prints out &#8220;<strong>Hello World!<\/strong>&#8220;. Otherwise, it prints out &#8220;<strong>nothing to do!<\/strong>&#8220;.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Create demoIf Stored Procedure<\/em><\/span>\n<\/p>\n<pre class=\"wp-block-preformatted brush:sql;highlight:[12]\">DELIMITER \/\/\n\nDROP PROCEDURE IF EXISTS demoIf; \/\/\nSHOW PROCEDURE STATUS WHERE Db = 'mysqlDemo';    \/\/\n\nCREATE PROCEDURE demoIf(\n    IN type VARCHAR(\n    1) )\n  BEGIN\n    IF type = \"P\" THEN\n      SELECT direction,\n             IF(direction=1,\"Sync Change From Remedy to Snow\", IF(direction=2,\"Sync Incident From Remedy to Snow\", \"Sync Change From Snow to Remedy\")) as DirectionMsg\n      FROM demo_table;\n    ELSE\n      IF type = \"A\" THEN\n        SELECT \"Hello World!\" as DirectionMsg;\n      ELSE\n        SELECT \"nothing to do!\" as DirectionMsg;\n      END IF;\n    END IF;\nEND \/\/\n<\/pre>\n<p><strong>Line 12<\/strong>: I add an <strong>IF<\/strong> function in a <strong>Select<\/strong> statement.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-4-2-call-the-stored-procedure\">4.2 Call the Stored Procedure<\/h3>\n<p>In this step, I will call the <strong>demoIf<\/strong> stored procedure with three different values: <strong>N<\/strong>, <strong>A<\/strong>, and <strong>P<\/strong> and capture the outputs.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Execute demoIf Stored Procedure<\/em><\/span>\n<\/p>\n<pre class=\"wp-block-preformatted brush:sql\">mysql&gt; mysql&gt; CALL demoIf('N');\/\/\n+----------------+\n| DirectionMsg   |\n+----------------+\n| nothing to do! |\n+----------------+\n1 row in set (0.00 sec)\n\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql&gt; CALL demoIf('A');\/\/\n+--------------+\n| DirectionMsg |\n+--------------+\n| Hello World! |\n+--------------+\n1 row in set (0.00 sec)\n\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql&gt; CALL demoIf('P');\/\/\n+-----------+-----------------------------------+\n| direction | DirectionMsg                      |\n+-----------+-----------------------------------+\n|         1 | Sync Change From Remedy to Snow   |\n|         2 | Sync Incident From Remedy to Snow |\n|         3 | Sync Change From Snow to Remedy   |\n+-----------+-----------------------------------+\n3 rows in set (0.00 sec)\n\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql&gt;\n\nmysql&gt;<\/pre>\n<h2 class=\"wp-block-heading\" id=\"h-5-summary\">5. Summary<\/h2>\n<p>In this example, I demonstrated how to use the <strong>IF<\/strong> function and <strong>IF<\/strong> statement in the MySQL database.  The Oracle PL\/SQL <strong>IF<\/strong> statement has the same syntax too. Click <a href=\"https:\/\/docs.oracle.com\/cd\/B19306_01\/appdev.102\/b14261\/if_statement.htm\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a> for more details. <\/p>\n<h2 class=\"wp-block-heading\" id=\"h-6-download-the-source-code\">6. Download the Source Code<\/h2>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here:<a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/12\/sqlIfstatement.zip\"><strong> SQL IF Statement Example<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. Introduction Structured Query Language (SQL) supports the IF statement like any other programming language. The IF statement tests a boolean expression. If the expression is true, then the block of statements associated with the IF statement is executed. It can also be used with an ELSE statement; In this example, I will demonstrate how &hellip;<\/p>\n","protected":false},"author":140,"featured_media":1204,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[647],"class_list":["post-106317","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql","tag-mysql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQL IF Statement Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"The SQL IF statement is very similar to the IF function, as it branches out the execution statements.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL IF Statement Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"The SQL IF statement is very similar to the IF function, as it branches out the execution statements.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-16T09:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Mary Zheng\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mary Zheng\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/\"},\"author\":{\"name\":\"Mary Zheng\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/8a2034fbabcb20a9396e9819261855ae\"},\"headline\":\"SQL IF Statement Example\",\"datePublished\":\"2021-12-16T09:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/\"},\"wordCount\":387,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"keywords\":[\"mysql\"],\"articleSection\":[\"sql\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/\",\"name\":\"SQL IF Statement Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"datePublished\":\"2021-12-16T09:00:00+00:00\",\"description\":\"The SQL IF statement is very similar to the IF function, as it branches out the execution statements.\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"Bipartite Graph\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Core Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"sql\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/sql\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"SQL IF Statement Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/8a2034fbabcb20a9396e9819261855ae\",\"name\":\"Mary Zheng\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/11\/Mary-Zheng_avatar_1510732235-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/11\/Mary-Zheng_avatar_1510732235-96x96.jpg\",\"caption\":\"Mary Zheng\"},\"description\":\"Mary has graduated from Mechanical Engineering department at ShangHai JiaoTong University. She also holds a Master degree in Computer Science from Webster University. During her studies she has been involved with a large number of projects ranging from programming and software engineering. She works as a senior Software Engineer in the telecommunications sector where she acts as a leader and works with others to design, implement, and monitor the software solution.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/mary-zheng\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL IF Statement Example - Java Code Geeks","description":"The SQL IF statement is very similar to the IF function, as it branches out the execution statements.","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:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/","og_locale":"en_US","og_type":"article","og_title":"SQL IF Statement Example - Java Code Geeks","og_description":"The SQL IF statement is very similar to the IF function, as it branches out the execution statements.","og_url":"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2021-12-16T09:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","type":"image\/jpeg"}],"author":"Mary Zheng","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Mary Zheng","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/"},"author":{"name":"Mary Zheng","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/8a2034fbabcb20a9396e9819261855ae"},"headline":"SQL IF Statement Example","datePublished":"2021-12-16T09:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/"},"wordCount":387,"commentCount":1,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","keywords":["mysql"],"articleSection":["sql"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/","url":"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/","name":"SQL IF Statement Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","datePublished":"2021-12-16T09:00:00+00:00","description":"The SQL IF statement is very similar to the IF function, as it branches out the execution statements.","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","width":150,"height":150,"caption":"Bipartite Graph"},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/sql-if-statement-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Core Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/"},{"@type":"ListItem","position":4,"name":"sql","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/sql\/"},{"@type":"ListItem","position":5,"name":"SQL IF Statement Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/8a2034fbabcb20a9396e9819261855ae","name":"Mary Zheng","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/11\/Mary-Zheng_avatar_1510732235-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/11\/Mary-Zheng_avatar_1510732235-96x96.jpg","caption":"Mary Zheng"},"description":"Mary has graduated from Mechanical Engineering department at ShangHai JiaoTong University. She also holds a Master degree in Computer Science from Webster University. During her studies she has been involved with a large number of projects ranging from programming and software engineering. She works as a senior Software Engineer in the telecommunications sector where she acts as a leader and works with others to design, implement, and monitor the software solution.","url":"https:\/\/examples.javacodegeeks.com\/author\/mary-zheng\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/106317","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/140"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=106317"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/106317\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1204"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=106317"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=106317"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=106317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}