{"id":322,"date":"2015-12-04T22:23:59","date_gmt":"2015-12-04T15:23:59","guid":{"rendered":"http:\/\/www.sqlitetutorial.net\/?page_id=322"},"modified":"2024-04-29T09:32:30","modified_gmt":"2024-04-29T02:32:30","slug":"sqlite-union","status":"publish","type":"page","link":"https:\/\/www.sqlitetutorial.net\/sqlite-union\/","title":{"rendered":"SQLite Union"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn how to use the SQLite <code>UNION<\/code> operator to combine result sets of two queries into a single result set.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction to SQLite UNION operator<\/h2>\n\n\n\n<p>Sometimes, you need to combine the results of multiple queries into a single result set. To achieve this, you can use the <code>UNION<\/code> operator. <\/p>\n\n\n\n<p>Here&#8217;s the syntax of the <code>UNION<\/code> operator:<\/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\">query1\nUNION &#91;ALL]\nquery2;<\/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>In this syntax:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, specify the first query.<\/li>\n\n\n\n<li>Second, use the UNION operator to indicate that you want to combine the result set of the first query with the next one.<\/li>\n\n\n\n<li>Third, specify the second query.<\/li>\n<\/ul>\n\n\n\n<p>The <code>UNION<\/code> operator eliminates duplicate rows in the final result set. If you want to retain the duplicate rows, you can use the <code>UNION ALL<\/code> operator.<\/p>\n\n\n\n<p>Here are the rules for the queries when using the <code>UNION<\/code> operator:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The queries (<code>query1 <\/code>and <code>query2<\/code>) have the same number of columns.<\/li>\n\n\n\n<li>The corresponding columns must have compatible data types.<\/li>\n\n\n\n<li>The column names of the first query determine the column names of the combined result set.<\/li>\n\n\n\n<li>If you use the <code><a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-group-by\/\">GROUP BY<\/a><\/code> and <code><a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-having\/\">HAVING<\/a><\/code> clauses, they will be applied to each query, not the final result set.<\/li>\n\n\n\n<li>If you use the <code><a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-order-by\/\">ORDER BY<\/a><\/code> clause, it will be applied to the combined result set, not the individual result set.<\/li>\n<\/ul>\n\n\n\n<p>Note that the difference between <code>UNION<\/code> and <code>JOIN<\/code> e.g., <code><a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-inner-join\/\">INNER JOIN<\/a><\/code> or <code><a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-left-join\/\">LEFT JOIN<\/a><\/code> is that the <code>JOIN<\/code> clause combines <em>columns<\/em> from multiple related tables, whereas the <code>UNION<\/code> operator combines <em>rows<\/em> from multiple result sets.<\/p>\n\n\n\n<p>Suppose you have two tables <code>t1<\/code> and <code>t2<\/code> with the following structures:<\/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\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span>  t1 (c1 <span class=\"hljs-built_in\">INT<\/span>);\n\n<span class=\"hljs-keyword\">INSERT<\/span> <span class=\"hljs-keyword\">INTO<\/span>\n  t1 (c1)\n<span class=\"hljs-keyword\">VALUES<\/span>\n  (<span class=\"hljs-number\">1<\/span>),\n  (<span class=\"hljs-number\">2<\/span>),\n  (<span class=\"hljs-number\">3<\/span>);\n\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> t2 (c2 <span class=\"hljs-built_in\">INT<\/span>);\n\n<span class=\"hljs-keyword\">INSERT<\/span> <span class=\"hljs-keyword\">INTO<\/span>\n  t2 (c2)\n<span class=\"hljs-keyword\">VALUES<\/span>\n  (<span class=\"hljs-number\">2<\/span>),\n  (<span class=\"hljs-number\">3<\/span>),\n  (<span class=\"hljs-number\">4<\/span>);<\/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>The following statement combines the result sets of the t1 and t2 tables using the <code>UNION<\/code> operator:<\/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> c1 <span class=\"hljs-keyword\">FROM<\/span> t1\n<span class=\"hljs-keyword\">UNION<\/span>\n<span class=\"hljs-keyword\">SELECT<\/span> c2 <span class=\"hljs-keyword\">FROM<\/span> t2;<\/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>Here is the output:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">c1\n--\n1\n2\n3\n4<\/code><\/span><\/pre>\n\n\n<p>The following picture illustrates the <code>UNION<\/code> operation of t1 and t2 tables:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"769\" height=\"214\" src=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION.png\" alt=\"SQLite UNION\" class=\"wp-image-1553\" srcset=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION.png 769w, https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION-300x83.png 300w, https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION-768x214.png 768w\" sizes=\"auto, (max-width: 769px) 100vw, 769px\" \/><\/figure>\n\n\n\n<p>The following statement combines the result sets of t1 and t2 tables using the\u00a0 <code>UNION ALL<\/code> operator:<\/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>\n  c1\n<span class=\"hljs-keyword\">FROM<\/span>\n  t1\n<span class=\"hljs-keyword\">UNION<\/span> <span class=\"hljs-keyword\">ALL<\/span>\n<span class=\"hljs-keyword\">SELECT<\/span>\n  c2\n<span class=\"hljs-keyword\">FROM<\/span>\n  t2;<\/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>Output:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">c1\n--\n1\n2\n3\n2\n3\n4<\/code><\/span><\/pre>\n\n\n<p>The following picture illustrates the <code>UNION ALL<\/code> operation of the result sets of <code>t1<\/code> and <code>t2<\/code> tables:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"769\" height=\"214\" src=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION-ALL.png\" alt=\"SQLite UNION ALL\" class=\"wp-image-1556\" srcset=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION-ALL.png 769w, https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION-ALL-300x83.png 300w, https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION-ALL-768x214.png 768w\" sizes=\"auto, (max-width: 769px) 100vw, 769px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">SQLite UNION operator examples<\/h2>\n\n\n\n<p>Let&#8217;s take some examples of using the <code>UNION<\/code> operator. We&#8217;ll use the <code>employees<\/code> and <code>customers<\/code> tables from the <a href=\"https:\/\/www.sqlitetutorial.net\/sqlite-sample-database\/\">sample database<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1) Basic SQLite UNION operator example<\/h3>\n\n\n\n<p>This statement uses the <code>UNION<\/code> operator to combine the names of <code>employees<\/code> and <code>customers<\/code> into a single list:<\/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\">SELECT<\/span>\n  FirstName,\n  LastName,\n  <span class=\"hljs-string\">'Employee'<\/span> <span class=\"hljs-keyword\">AS<\/span> <span class=\"hljs-keyword\">Type<\/span>\n<span class=\"hljs-keyword\">FROM<\/span>\n  employees\n<span class=\"hljs-keyword\">UNION<\/span>\n<span class=\"hljs-keyword\">SELECT<\/span>\n  FirstName,\n  LastName,\n  <span class=\"hljs-string\">'Customer'<\/span>\n<span class=\"hljs-keyword\">FROM<\/span>\n  customers;<\/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>Here is the partial output:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">FirstName  LastName      Type\n---------  ------------  --------\nAaron      Mitchell      Customer\nAlexandre  Rocha         Customer\nAndrew     Adams         Employee\nAstrid     Gruber        Customer\nBj\u00f8rn      Hansen        Customer\nCamille    Bernard       Customer\n...<\/code><\/span><\/pre>\n\n\n<h3 class=\"wp-block-heading\">2) Using the UNION operator with ORDER BY example<\/h3>\n\n\n\n<p>This example uses the <code>UNION<\/code> operator to combine the names of the employees and customers into a single list. In addition, it uses the <code>ORDER BY<\/code> clause to sort the name list by first name and last name.<\/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\">SELECT<\/span>\n  FirstName,\n  LastName,\n  <span class=\"hljs-string\">'Employee'<\/span> <span class=\"hljs-keyword\">AS<\/span> <span class=\"hljs-keyword\">Type<\/span>\n<span class=\"hljs-keyword\">FROM<\/span>\n  employees\n<span class=\"hljs-keyword\">UNION<\/span>\n<span class=\"hljs-keyword\">SELECT<\/span>\n  FirstName,\n  LastName,\n  <span class=\"hljs-string\">'Customer'<\/span>\n<span class=\"hljs-keyword\">FROM<\/span>\n  customers\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span>\n  FirstName,\n  LastName;<\/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>Here is the partial output:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">FirstName  LastName      Type\n---------  ------------  --------\nAaron      Mitchell      Customer\nAlexandre  Rocha         Customer\nAndrew     Adams         Employee\nAstrid     Gruber        Customer\nBj\u00f8rn      Hansen        Customer\nCamille    Bernard       Customer\nDaan       Peeters       Customer\nDan        Miller        Customer\nDiego      Guti\u00e9rrez     Customer\nDominique  Lefebvre      Customer\nEduardo    Martins       Customer\n...<\/code><\/span><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the <code>UNION<\/code> operator to combine rows from two result sets into a single result set. <\/li>\n\n\n\n<li>Use the <code>UNION ALL<\/code> operator to retain the duplicate rows in the final result set.<\/li>\n<\/ul>\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=\"322\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqlitetutorial.net\/sqlite-union\/\"\n\t\t\t\tdata-post-title=\"SQLite Union\"\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=\"322\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqlitetutorial.net\/sqlite-union\/\"\n\t\t\t\tdata-post-title=\"SQLite Union\"\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>You will learn how to use the SQLite UNION operator to combine result sets of two or more queries into a single result set.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2,"menu_order":21,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-322","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 UNION Operator<\/title>\n<meta name=\"description\" content=\"You will learn how to use the SQLite UNION operator to combine result sets of two or more queries into a single result set.\" \/>\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-union\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQLite UNION Operator\" \/>\n<meta property=\"og:description\" content=\"You will learn how to use the SQLite UNION operator to combine result sets of two or more queries into a single result set.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlitetutorial.net\/sqlite-union\/\" \/>\n<meta property=\"og:site_name\" content=\"SQLite Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-29T02:32:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION.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-union\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-union\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/#\/schema\/person\/6d69b968cad0102e30d6694ed8dc6427\"},\"headline\":\"SQLite Union\",\"datePublished\":\"2015-12-04T15:23:59+00:00\",\"dateModified\":\"2024-04-29T02:32:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-union\/\"},\"wordCount\":425,\"image\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-union\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION.png\",\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-union\/\",\"url\":\"https:\/\/www.sqlitetutorial.net\/sqlite-union\/\",\"name\":\"SQLite UNION Operator\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-union\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-union\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION.png\",\"datePublished\":\"2015-12-04T15:23:59+00:00\",\"dateModified\":\"2024-04-29T02:32:30+00:00\",\"description\":\"You will learn how to use the SQLite UNION operator to combine result sets of two or more queries into a single result set.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-union\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlitetutorial.net\/sqlite-union\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-union\/#primaryimage\",\"url\":\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION.png\",\"contentUrl\":\"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION.png\",\"width\":769,\"height\":214,\"caption\":\"SQLite UNION\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-union\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlitetutorial.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQLite Tutorial\",\"item\":\"https:\/\/www.sqlitetutorial.net\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"SQLite Union\"}]},{\"@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 UNION Operator","description":"You will learn how to use the SQLite UNION operator to combine result sets of two or more queries into a single result set.","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-union\/","og_locale":"en_US","og_type":"article","og_title":"SQLite UNION Operator","og_description":"You will learn how to use the SQLite UNION operator to combine result sets of two or more queries into a single result set.","og_url":"https:\/\/www.sqlitetutorial.net\/sqlite-union\/","og_site_name":"SQLite Tutorial","article_modified_time":"2024-04-29T02:32:30+00:00","og_image":[{"url":"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION.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-union\/#article","isPartOf":{"@id":"https:\/\/www.sqlitetutorial.net\/sqlite-union\/"},"author":{"name":"admin","@id":"https:\/\/www.sqlitetutorial.net\/#\/schema\/person\/6d69b968cad0102e30d6694ed8dc6427"},"headline":"SQLite Union","datePublished":"2015-12-04T15:23:59+00:00","dateModified":"2024-04-29T02:32:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.sqlitetutorial.net\/sqlite-union\/"},"wordCount":425,"image":{"@id":"https:\/\/www.sqlitetutorial.net\/sqlite-union\/#primaryimage"},"thumbnailUrl":"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION.png","inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.sqlitetutorial.net\/sqlite-union\/","url":"https:\/\/www.sqlitetutorial.net\/sqlite-union\/","name":"SQLite UNION Operator","isPartOf":{"@id":"https:\/\/www.sqlitetutorial.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.sqlitetutorial.net\/sqlite-union\/#primaryimage"},"image":{"@id":"https:\/\/www.sqlitetutorial.net\/sqlite-union\/#primaryimage"},"thumbnailUrl":"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION.png","datePublished":"2015-12-04T15:23:59+00:00","dateModified":"2024-04-29T02:32:30+00:00","description":"You will learn how to use the SQLite UNION operator to combine result sets of two or more queries into a single result set.","breadcrumb":{"@id":"https:\/\/www.sqlitetutorial.net\/sqlite-union\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlitetutorial.net\/sqlite-union\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlitetutorial.net\/sqlite-union\/#primaryimage","url":"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION.png","contentUrl":"https:\/\/www.sqlitetutorial.net\/wp-content\/uploads\/2018\/11\/SQLite-UNION.png","width":769,"height":214,"caption":"SQLite UNION"},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlitetutorial.net\/sqlite-union\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlitetutorial.net\/"},{"@type":"ListItem","position":2,"name":"SQLite Tutorial","item":"https:\/\/www.sqlitetutorial.net\/"},{"@type":"ListItem","position":3,"name":"SQLite Union"}]},{"@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\/322","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=322"}],"version-history":[{"count":3,"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages\/322\/revisions"}],"predecessor-version":[{"id":3401,"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages\/322\/revisions\/3401"}],"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=322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}