{"id":679,"date":"2015-12-22T12:07:12","date_gmt":"2015-12-22T05:07:12","guid":{"rendered":"http:\/\/www.sqlitetutorial.net\/?page_id=679"},"modified":"2022-04-03T15:03:08","modified_gmt":"2022-04-03T08:03:08","slug":"sqlite-case","status":"publish","type":"page","link":"https:\/\/www.sqlitetutorial.net\/sqlite-case\/","title":{"rendered":"SQLite CASE"},"content":{"rendered":"\r\n<p><strong>Summary: <\/strong>in this tutorial, you will learn about the SQLite <code>CASE<\/code>&nbsp;expression to add the conditional logic to a query.<\/p>\r\n\r\n\r\n\r\n<p>The SQLite <code>CASE<\/code> expression evaluates a list of conditions and returns an expression based on the result of the evaluation.<\/p>\r\n\r\n\r\n\r\n<p>The <code>CASE<\/code> expression is similar to the <code>IF-THEN-ELSE<\/code> statement in other programming languages.<\/p>\r\n\r\n\r\n\r\n<p>You can use the <code>CASE<\/code> expression in any clause or statement that accepts a valid expression. For example, you can use the <code>CASE<\/code> expression in clauses such as <code><a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-where\/\">WHERE<\/a><\/code>, <a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-order-by\/\"><code>ORDER BY<\/code><\/a>, <code><a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-having\/\">HAVING<\/a><\/code>, <code><a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-select\/\">SELECT<\/a><\/code> and statements such as <code><a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-select\/\">SELECT<\/a><\/code>, <code><a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-update\/\">UPDATE<\/a><\/code>, and <code><a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-delete\/\">DELETE<\/a><\/code>.<\/p>\r\n\r\n\r\n\r\n<p>SQLite provides two forms of the <code>CASE<\/code> expression: simple <code>CASE<\/code> and searched <code>CASE<\/code>.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">SQLite simple CASE expression<\/h2>\r\n\r\n\r\n\r\n<p>The simple <code>CASE<\/code> expression compares an expression to a list of expressions to return the result. The following illustrates the syntax of the simple <code>CASE<\/code> expression.<\/p>\r\n\r\n\r\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\">CASE case_expression\r\n     WHEN when_expression_1 THEN result_1\r\n     WHEN when_expression_2 THEN result_2\r\n     ...\r\n     &#91; ELSE result_else ] \r\n<span class=\"hljs-keyword\">END<\/span><\/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>\r\n\r\n\r\n<p>The simple <code>CASE<\/code> expression compares the <code>case_expression<\/code> to the expression appears in the first <code>WHEN<\/code> clause, <code>when_expression_1<\/code>, for equality.<\/p>\r\n\r\n\r\n\r\n<p>If the <code>case_expression<\/code> equals <code>when_expression_1<\/code>, the simple <code>CASE<\/code> returns the expression in the corresponding <code>THEN<\/code> clause, which is the <code>result_1<\/code>.<\/p>\r\n\r\n\r\n\r\n<p>Otherwise, the simple <code>CASE<\/code> expression compares the <code>case_expression<\/code> with the expression in the next <code>WHEN<\/code> clause.<\/p>\r\n\r\n\r\n\r\n<p>In case no <code>case_expression<\/code> matches the <code>when_expression<\/code>, the <code>CASE<\/code> expression returns the <code>result_else<\/code> in the <code>ELSE<\/code> clause. If you omit the <code>ELSE<\/code> clause, the <code>CASE<\/code> expression returns NULL.<\/p>\r\n\r\n\r\n\r\n<p>The simple <code>CASE<\/code> expression uses&nbsp;short-circuit evaluation. In other words, it returns the result and stop evaluating other conditions as soon as it finds a match.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\">Simple CASE example<\/h3>\r\n\r\n\r\n\r\n<p>Let&#8217;s take a look at the <code>customers<\/code> table in the <a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/\">sample database<\/a>.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"174\" height=\"304\" src=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/customers.png\" alt=\"customers\" class=\"wp-image-1561\" srcset=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/customers.png 174w, https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/customers-172x300.png 172w\" sizes=\"auto, (max-width: 174px) 100vw, 174px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>Suppose, you have to make a report of the customer groups with the logic that if a customer locates in the USA, this customer belongs to the domestic group, otherwise the customer belongs to the foreign group.<\/p>\r\n\r\n\r\n\r\n<p>To make this report, you use the simple <code>CASE<\/code> expression in the <code>SELECT<\/code> statement as follows:<\/p>\r\n\r\n\r\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> customerid,\r\n       firstname,\r\n       lastname,\r\n       <span class=\"hljs-keyword\">CASE<\/span> country \r\n           <span class=\"hljs-keyword\">WHEN<\/span> <span class=\"hljs-string\">'USA'<\/span> \r\n               <span class=\"hljs-keyword\">THEN<\/span> <span class=\"hljs-string\">'Domestic'<\/span> \r\n           <span class=\"hljs-keyword\">ELSE<\/span> <span class=\"hljs-string\">'Foreign'<\/span> \r\n       <span class=\"hljs-keyword\">END<\/span> CustomerGroup\r\n<span class=\"hljs-keyword\">FROM<\/span> \r\n    customers\r\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span> \r\n    LastName,\r\n    FirstName;<\/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>\r\n\r\n\r\n<p><a class=\"sql\" href=\"https:\/\/www.sqlitetutorial.net\/tryit\/query\/sqlite-case\/#1\" target=\"_blank\" rel=\"noopener noreferrer\">Try It<\/a><\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">SQLite searched CASE expression<\/h2>\r\n\r\n\r\n\r\n<p>The searched <code>CASE<\/code> expression evaluates a list of expressions to decide the result. Note that the simple <code>CASE<\/code>&nbsp;expression only compares for equality, while the searched <code>CASE<\/code> expression can use any forms of comparison.<\/p>\r\n\r\n\r\n\r\n<p>The following illustrates the syntax of the searched <code>CASE<\/code> expression.<\/p>\r\n\r\n\r\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\">CASE\r\n     WHEN bool_expression_1 THEN result_1\r\n     WHEN bool_expression_2 THEN result_2\r\n     &#91; ELSE result_else ] \r\n<span class=\"hljs-keyword\">END<\/span><\/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>\r\n\r\n\r\n<p>The searched <code>CASE<\/code> expression evaluates the Boolean expressions in the sequence specified and return the corresponding result if the expression evaluates to true.<\/p>\r\n\r\n\r\n\r\n<p>In case no expression evaluates to true, the searched <code>CASE<\/code> expression returns the expression in the <code>ELSE<\/code> clause if specified. If you omit the <code>ELSE<\/code> clause, the searched <code>CASE<\/code> expression returns <code>NULL<\/code>.<\/p>\r\n\r\n\r\n\r\n<p>Similar to the simple <code>CASE<\/code> expression, the searched <code>CASE<\/code>&nbsp;expression stops the evaluation when a condition is met.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\">Searched CASE example<\/h3>\r\n\r\n\r\n\r\n<p>We will use the <code>tracks<\/code> table for the demonstration.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"174\" height=\"224\" src=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/tracks.png\" alt=\"\" class=\"wp-image-1558\"\/><\/figure>\r\n\r\n\r\n\r\n<p>Suppose you want to classify the tracks based on its length such as less a minute, the track is short; between 1 and 5 minutes, the track is medium; greater than 5 minutes, the track is long.<\/p>\r\n\r\n\r\n\r\n<p>To achieve this, you use the searched <code>CASE<\/code> expression as follows:<\/p>\r\n\r\n\r\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>\r\n\ttrackid,\r\n\t<span class=\"hljs-keyword\">name<\/span>,\r\n\t<span class=\"hljs-keyword\">CASE<\/span>\r\n\t\t<span class=\"hljs-keyword\">WHEN<\/span> milliseconds &lt; <span class=\"hljs-number\">60000<\/span> <span class=\"hljs-keyword\">THEN<\/span>\r\n\t\t\t<span class=\"hljs-string\">'short'<\/span>\r\n\t\t<span class=\"hljs-keyword\">WHEN<\/span> milliseconds &gt; <span class=\"hljs-number\">60000<\/span> <span class=\"hljs-keyword\">AND<\/span> milliseconds &lt; <span class=\"hljs-number\">300000<\/span> <span class=\"hljs-keyword\">THEN<\/span> <span class=\"hljs-string\">'medium'<\/span>\r\n\t\t<span class=\"hljs-keyword\">ELSE<\/span>\r\n\t\t\t<span class=\"hljs-string\">'long'<\/span>\r\n\t\t<span class=\"hljs-keyword\">END<\/span> <span class=\"hljs-keyword\">category<\/span>\r\n<span class=\"hljs-keyword\">FROM<\/span>\r\n\ttracks;<\/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>\r\n\r\n\r\n<p><a class=\"sql\" href=\"https:\/\/www.sqlitetutorial.net\/tryit\/query\/sqlite-case\/#2\" target=\"_blank\" rel=\"noopener noreferrer\">Try It<\/a><\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"398\" height=\"302\" src=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2015\/12\/SQLite-Searched-CASE-example.png\" alt=\"SQLite Searched CASE example\" class=\"wp-image-681\" srcset=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2015\/12\/SQLite-Searched-CASE-example.png 398w, https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2015\/12\/SQLite-Searched-CASE-example-300x228.png 300w\" sizes=\"auto, (max-width: 398px) 100vw, 398px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>In this tutorial, you have learned about SQLite <code>CASE<\/code> expression to form conditional logic inside a SQL query.<\/p>\r\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=\"679\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqlitetutorial.net\/sqlite-case\/\"\n\t\t\t\tdata-post-title=\"SQLite CASE\"\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=\"679\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqlitetutorial.net\/sqlite-case\/\"\n\t\t\t\tdata-post-title=\"SQLite CASE\"\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>In this tutorial, you will learn about the SQLite CASE expression to add the conditional logic to a query.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2,"menu_order":28,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-679","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SQLite CASE Expression: Simple CASE &amp; Search CASE<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will learn about the SQLite CASE expression to add the conditional logic to a query.\" \/>\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.sqlitetutorial.net\/sqlite-case\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQLite CASE Expression: Simple CASE &amp; Search CASE\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn about the SQLite CASE expression to add the conditional logic to a query.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlitetutorial.net\/sqlite-case\/\" \/>\n<meta property=\"og:site_name\" content=\"SQLite Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-03T08:03:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/customers.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-case\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-case\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/#\/schema\/person\/6d69b968cad0102e30d6694ed8dc6427\"},\"headline\":\"SQLite CASE\",\"datePublished\":\"2015-12-22T05:07:12+00:00\",\"dateModified\":\"2022-04-03T08:03:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-case\/\"},\"wordCount\":460,\"image\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-case\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/customers.png\",\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-case\/\",\"url\":\"https:\/\/www.sqlitetutorial.net\/sqlite-case\/\",\"name\":\"SQLite CASE Expression: Simple CASE & Search CASE\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-case\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-case\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/customers.png\",\"datePublished\":\"2015-12-22T05:07:12+00:00\",\"dateModified\":\"2022-04-03T08:03:08+00:00\",\"description\":\"In this tutorial, you will learn about the SQLite CASE expression to add the conditional logic to a query.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-case\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlitetutorial.net\/sqlite-case\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-case\/#primaryimage\",\"url\":\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/customers.png\",\"contentUrl\":\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/customers.png\",\"width\":174,\"height\":304,\"caption\":\"customers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-case\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlitetutorial.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQLite CASE\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/#website\",\"url\":\"https:\/\/www.sqlitetutorial.net\/\",\"name\":\"SQLite Tutorial\",\"description\":\"A Step-by-step SQLite Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlitetutorial.net\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/#\/schema\/person\/6d69b968cad0102e30d6694ed8dc6427\",\"name\":\"admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQLite CASE Expression: Simple CASE & Search CASE","description":"In this tutorial, you will learn about the SQLite CASE expression to add the conditional logic to a query.","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.sqlitetutorial.net\/sqlite-case\/","og_locale":"en_US","og_type":"article","og_title":"SQLite CASE Expression: Simple CASE & Search CASE","og_description":"In this tutorial, you will learn about the SQLite CASE expression to add the conditional logic to a query.","og_url":"https:\/\/www.sqlitetutorial.net\/sqlite-case\/","og_site_name":"SQLite Tutorial","article_modified_time":"2022-04-03T08:03:08+00:00","og_image":[{"url":"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/customers.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.sqlitetutorial.net\/sqlite-case\/#article","isPartOf":{"@id":"https:\/\/www.sqlitetutorial.net\/sqlite-case\/"},"author":{"name":"admin","@id":"https:\/\/www.sqlitetutorial.net\/#\/schema\/person\/6d69b968cad0102e30d6694ed8dc6427"},"headline":"SQLite CASE","datePublished":"2015-12-22T05:07:12+00:00","dateModified":"2022-04-03T08:03:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.sqlitetutorial.net\/sqlite-case\/"},"wordCount":460,"image":{"@id":"https:\/\/www.sqlitetutorial.net\/sqlite-case\/#primaryimage"},"thumbnailUrl":"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/customers.png","inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.sqlitetutorial.net\/sqlite-case\/","url":"https:\/\/www.sqlitetutorial.net\/sqlite-case\/","name":"SQLite CASE Expression: Simple CASE & Search CASE","isPartOf":{"@id":"https:\/\/www.sqlitetutorial.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.sqlitetutorial.net\/sqlite-case\/#primaryimage"},"image":{"@id":"https:\/\/www.sqlitetutorial.net\/sqlite-case\/#primaryimage"},"thumbnailUrl":"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/customers.png","datePublished":"2015-12-22T05:07:12+00:00","dateModified":"2022-04-03T08:03:08+00:00","description":"In this tutorial, you will learn about the SQLite CASE expression to add the conditional logic to a query.","breadcrumb":{"@id":"https:\/\/www.sqlitetutorial.net\/sqlite-case\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlitetutorial.net\/sqlite-case\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlitetutorial.net\/sqlite-case\/#primaryimage","url":"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/customers.png","contentUrl":"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/customers.png","width":174,"height":304,"caption":"customers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlitetutorial.net\/sqlite-case\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlitetutorial.net\/"},{"@type":"ListItem","position":2,"name":"SQLite CASE"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlitetutorial.net\/#website","url":"https:\/\/www.sqlitetutorial.net\/","name":"SQLite Tutorial","description":"A Step-by-step SQLite Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlitetutorial.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlitetutorial.net\/#\/schema\/person\/6d69b968cad0102e30d6694ed8dc6427","name":"admin"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages\/679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/comments?post=679"}],"version-history":[{"count":1,"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages\/679\/revisions"}],"predecessor-version":[{"id":2787,"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages\/679\/revisions\/2787"}],"up":[{"embeddable":true,"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages\/2"}],"wp:attachment":[{"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/media?parent=679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}