The parameters from the syntax are explained below:
value1, value2, ... value_n: The columns you wish to retrieve. You can also retrieve all the values using the SELECT * FROM query.
table1, table2: The tables that you wish to retrieve records from.
Things to consider: 1. The data types of corresponding columns in the SELECT queries must be compatible. 2. The order of columns is flexible as long as the columns in consecutive places are pairwise compatible. For example, you can do SELECT col1, col2 FROM table1 UNION SELECT col2, col1 FROM table2.
Example
Let’s consider an example of the UNION. Assume we have a table called employees and another table called contractors. We want to retrieve a combined list of names from both tables, excluding duplicates:
Verifying inserted values by using the SELECT statement:
SELECT * FROM employees;SELECT * FROM contractors;
emp_id | emp_name--------+---------- 1 | John 2 | Alice 3 | Bob contractor_id | contractor_name---------------+----------------- 101 | Alice 102 | Eve 103 | Tom
Let’s combine the values from the tables:
SELECT emp_name FROM employeesUNIONSELECT contractor_name FROM contractors;
You will get the values of both tables, and there won’t be any duplicate values.
emp_name---------- Alice Bob Eve John Tom
The diagram below shows that the duplicate name “Alice” is represented only once in the output, fulfilling the requirement to avoid duplicate entries.
UNION ALL
Overview
The UNION ALL combines the result sets of 2 or more select statements, returning all rows from the query and not removing duplicate rows between the tables.
The parameters from the syntax are explained below:
value1, value2, ... value_n: The columns you wish to retrieve. You can also retrieve all the values using the SELECT * FROM query.
table1, table2: The tables that you wish to retrieve records from.
Things to consider: 1. The data types of corresponding columns in the SELECT queries must be compatible. 2. The order of columns is flexible as long as the columns in consecutive places are pairwise compatible.
Example
Suppose you have two separate tables, sales_2022 and sales_2023, containing sales data for different years. You want to combine the sales data from both tables to get a complete list of sales transactions without removing duplicates.
Verifying inserted values by using the SELECT statement:
SELECT * FROM sales_2022;SELECT * FROM sales_2023;
transaction_id | product_name | sale_amount----------------+--------------+------------- 1 | Product A | 1000 2 | Product B | 500 3 | Product C | 750 transaction_id | product_name | sale_amount----------------+--------------+------------- 4 | Product A | 1200 5 | Product D | 800 6 | Product E | 950
Let’s combine all values from the tables by using the UNION ALL:
SELECT product_name, sale_amount FROM sales_2022 UNION ALL SELECT product_name, sale_amount FROM sales_2023;
In this case, it will display all the values of the first table followed by all the contents of the second table.
product_name | sale_amount--------------+------------- Product A | 1000 Product B | 500 Product C | 750 Product A | 1200 Product D | 800 Product E | 950
The diagram illustrates that with the UNION ALL, all values are displayed, including the duplicate ones.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Oxla Developer Hub","colors":{"primary":"#EEEEEE","light":"#EEEEEE","dark":"#232628"},"logo":{"light":"https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/logo/logo-light.svg?fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=4074307a3716643bc058dc994a8cf42f","dark":"https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/logo/logo-dark.svg?fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=1dfc90f7bfc27796145623a3c3bc8fa9","href":"https://docs.oxla.com/welcome"},"favicon":"/assets/images/favicon/oxla-favicon.svg","background":{"image":{"light":"https://mintlify.s3.us-west-1.amazonaws.com/oxla/assets/images/light/background/background-light.png","dark":"https://mintlify.s3.us-west-1.amazonaws.com/oxla/assets/images/dark/background/background-dark.png"}},"navbar":{"links":[{"label":"Oxla.com","href":"https://www.oxla.com/"},{"label":"Docker Hub","href":"https://hub.docker.com/r/oxla/oxla"},{"label":"Blog","href":"https://www.oxla.com/blog"}]},"footer":{"socials":{}},"seo":{"metatags":{"og:image":"https://mintlify.s3-us-west-1.amazonaws.com/oxla/assets/images/light/homepage-img-light.png"},"indexing":"navigable"},"banner":{"content":"Oxla has been acquired by Redpanda Data. [ Read the news here.](https://www.redpanda.com/blog/agentic-data-plane-adp)"},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"oxla","hasAudioNarration":false,"actualSubdomain":"oxla","customDomains":["docs.oxla.com"],"gitSource":{"type":"github","owner":"oxlacom","repo":"oxla-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ae91f38d9cf549fcc2932be:success","clientVersion":"0.0.4270","searchFilterCounts":[{"language":"default","tag":"Development Guide","count":226},{"language":"default","tag":"SQL Reference","count":200},{"language":"default","tag":"SQL Functions","count":133},{"language":"default","tag":"Aggregate","count":33},{"language":"default","tag":"SQL Statements","count":28},{"language":"default","tag":"Other","count":22},{"language":"default","tag":"Statistics","count":19},{"language":"default","tag":"Math","count":19},{"language":"default","tag":"Window","count":19},{"language":"default","tag":"SQL Clauses","count":18}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"@tailwind base;@tailwind components;@tailwind utilities;@import url(\"https://fonts.googleapis.com/css2?family=Funnel+Display:wght@300..800\u0026display=swap\");body{font-family:\"Funnel Display\";font-optical-sizing:auto;font-style:normal}.dark p{color:rgb(255, 255, 255)}:is(.dark .dark\\:bg-codeblock\\/50){filter:brightness()}:is(.dark .dark\\:bg-codeblock\\/50) svg{filter:brightness(10)}:is(.dark .dark\\:bg-codeblock\\/50):hover{filter:brightness(10)}:is(.dark\\:text-primary-light){color:#694AFE}:is(.dark .dark\\:text-primary-light){color:#694AFE}.prose:is(.dark *){color:white}.prose{color:black}:not(pre)>code:is(.dark *){background:#3C4043;border-width:0}:not(pre)>code{background:#CCCCCC;color:black;border-width:0}.prose a{color:#FF4C4C;text-decoration:none;border-bottom:1px solid #FF4C4C;transition:color 0.3s, border-bottom-width 0.1s, font-weight 0.1s}:is(.dark) .prose a{color:#FF4C4C;text-decoration:none;border-bottom:1px solid #FF4C4C;transition:color 0.3s, border-bottom-width 0.1s, font-weight 0.1s}.prose a:hover,.prose a:focus{color:#FF4C4C;border-bottom-width:2px;font-weight:900;outline:none}:is(.dark) .prose a:hover,:is(.dark) .prose a:focus{color:#FF4C4C;border-bottom-width:2px;font-weight:900;outline:none}.prose a:visited{color:#FF4C4C}:is(.dark) .prose a:visited{color:#FF4C4C}.card{background-color:#FAFAFA;border:2px solid #232628;box-shadow:0 4px 8px rgb(0, 0, 0, 0.2);border-radius:8px;padding:5px;transition:0.3s}:is(.dark) .card{background-color:#232628;border:2px solid #606263;box-shadow:0 4px 8px rgb(0, 0, 0, 0.2);border-radius:8px;padding:5px;transition:0.3s}"}]}
{"page":{"pagePath":"sql-reference/sql-clauses/set-operations/union","slug":"/sql-reference/sql-clauses/set-operations/union","pageMetadata":{"title":"UNION","createdAt":"2023-08-21T16:23:00.375Z","updatedAt":"2023-10-09T13:02:32.129Z","description":null,"href":"/sql-reference/sql-clauses/set-operations/union"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,OptimizedImage,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`union`,children:`UNION`}),`\n`,_jsx(Heading,{level:`3`,id:`overview`,children:`Overview`}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`UNION`}),` combines the result sets of 2 or more select statements, removing duplicate rows between the tables.`]}),`\n`,_jsx(Heading,{level:`3`,id:`syntax`,children:`Syntax`}),`\n`,_jsxs(_components.p,{children:[`Below is the syntax of the `,_jsx(_components.code,{children:`UNION`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` value1, value2, ... value_n`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` table1`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`UNION`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` value1, value2, ... value_n`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` table2;`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The parameters from the syntax are explained below:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`value1, value2, ... value_n`}),`: The columns you wish to retrieve. You can also retrieve all the values using the `,_jsx(_components.code,{children:`SELECT * FROM`}),` query.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`table1, table2`}),`: The tables that you wish to retrieve records from.`]}),`\n`]}),`\n`]}),`\n`,_jsxs(Tip,{children:[_jsx(_components.strong,{children:`Things to consider:`}),_jsx(`br`,{}),` 1. The data types of corresponding columns in the `,_jsx(_components.code,{children:`SELECT`}),` queries must be compatible. `,_jsx(`br`,{}),` 2. The order of columns is flexible as long as the columns in consecutive places are pairwise compatible. For example, you can do `,_jsx(_components.code,{children:`SELECT col1, col2 FROM table1 UNION SELECT col2, col1 FROM table2`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`example`,children:`Example`}),`\n`,_jsxs(_components.p,{children:[`Let’s consider an example of the `,_jsx(_components.code,{children:`UNION`}),`. Assume we have a table called `,_jsx(_components.code,{children:`employees`}),` and another table called `,_jsx(_components.code,{children:`contractors`}),`. We want to retrieve a combined list of names from both tables, excluding duplicates:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`19`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`19`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CREATE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` employees`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` emp_id `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`INT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` emp_name `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`TEXT`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CREATE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` contractors`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` contractor_id `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`INT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` contractor_name `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`TEXT`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`INSERT INTO`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` employees `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`VALUES`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'John'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Alice'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Bob'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`INSERT INTO`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` contractors `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`VALUES`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`101`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Alice'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`102`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Eve'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`103`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Tom'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Verifying inserted values by using the `,_jsx(_components.code,{children:`SELECT`}),` statement:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` employees;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` contractors;`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`11`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`emp_id | emp_name`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`--------+----------`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` | John`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` | Alice`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` | Bob`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` contractor_id | contractor_name`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`---------------+-----------------`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 101`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` | Alice`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 102`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` | Eve`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 103`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` | Tom`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Let’s combine the values from the tables:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` emp_name `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` employees`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`UNION`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` contractor_name `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` contractors;`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`You will get the values of both tables, and there won’t be any duplicate values.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`emp_name`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`----------`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Alice`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Bob`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Eve`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` John`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Tom`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The diagram below shows that the duplicate name “Alice” is represented only once in the output, fulfilling the requirement to avoid duplicate entries.`}),`\n`,_jsx(OptimizedImage,{className:`mint-block dark:mint-hidden`,src:`https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/light/union/union-one-light.png?fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=f4401879d67660f2de71f908bcaf56c8`,alt:``,\"data-og-width\":`2075`,width:`2075`,\"data-og-height\":`1408`,height:`1408`,\"data-path\":`assets/images/light/union/union-one-light.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/light/union/union-one-light.png?w=280\u0026fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=c94e24e2e93ad152864ffbdcf2e6414f 280w, https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/light/union/union-one-light.png?w=560\u0026fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=9b6cf65551541f8e2f9983419027f3f6 560w, https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/light/union/union-one-light.png?w=840\u0026fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=7ab5b221698bf3a9e6cfabf0926d0f40 840w, https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/light/union/union-one-light.png?w=1100\u0026fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=be6be496f809f8d140ee2de5069ad850 1100w, https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/light/union/union-one-light.png?w=1650\u0026fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=4f576859ecf2bd3bd3941d8964927d46 1650w, https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/light/union/union-one-light.png?w=2500\u0026fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=1b4fc4f8c0b0d5885ae2ed746031bf9c 2500w`}),`\n`,_jsx(OptimizedImage,{className:`mint-hidden dark:mint-block`,src:`https://mintcdn.com/oxla/scqzK0laaaAr3oxU/assets/images/dark/union/union-one-dark.png?fit=max\u0026auto=format\u0026n=scqzK0laaaAr3oxU\u0026q=85\u0026s=4bb9156c24db69ec2b32948882fb040e`,alt:``,\"data-og-width\":`2075`,width:`2075`,\"data-og-height\":`1408`,height:`1408`,\"data-path\":`assets/images/dark/union/union-one-dark.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/oxla/scqzK0laaaAr3oxU/assets/images/dark/union/union-one-dark.png?w=280\u0026fit=max\u0026auto=format\u0026n=scqzK0laaaAr3oxU\u0026q=85\u0026s=80863d70887da9056b67723387808156 280w, https://mintcdn.com/oxla/scqzK0laaaAr3oxU/assets/images/dark/union/union-one-dark.png?w=560\u0026fit=max\u0026auto=format\u0026n=scqzK0laaaAr3oxU\u0026q=85\u0026s=5b7366e55fac4d279af7c88b53aa181b 560w, https://mintcdn.com/oxla/scqzK0laaaAr3oxU/assets/images/dark/union/union-one-dark.png?w=840\u0026fit=max\u0026auto=format\u0026n=scqzK0laaaAr3oxU\u0026q=85\u0026s=15f27485bcf7096e26ee7edc0cb1d5a7 840w, https://mintcdn.com/oxla/scqzK0laaaAr3oxU/assets/images/dark/union/union-one-dark.png?w=1100\u0026fit=max\u0026auto=format\u0026n=scqzK0laaaAr3oxU\u0026q=85\u0026s=57cffb4ed2b5c3b30ae5df0c58f04d0f 1100w, https://mintcdn.com/oxla/scqzK0laaaAr3oxU/assets/images/dark/union/union-one-dark.png?w=1650\u0026fit=max\u0026auto=format\u0026n=scqzK0laaaAr3oxU\u0026q=85\u0026s=3f18640e9eb96690b15dd660a8c304ac 1650w, https://mintcdn.com/oxla/scqzK0laaaAr3oxU/assets/images/dark/union/union-one-dark.png?w=2500\u0026fit=max\u0026auto=format\u0026n=scqzK0laaaAr3oxU\u0026q=85\u0026s=745ebb6917010ce6c447ef22cd40d735 2500w`}),`\n`,_jsx(Heading,{level:`2`,id:`union-all`,children:`UNION ALL`}),`\n`,_jsx(Heading,{level:`3`,id:`overview-2`,children:`Overview`}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`UNION ALL`}),` combines the result sets of 2 or more select statements, returning all rows from the query and not removing duplicate rows between the tables.`]}),`\n`,_jsx(Heading,{level:`3`,id:`syntax-2`,children:`Syntax`}),`\n`,_jsxs(_components.p,{children:[`Below is the syntax of the `,_jsx(_components.code,{children:`UNION ALL`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` value1, value2, ... value_n`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tables`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`UNION ALL`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` value1, value2, ... value_n`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tables;`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The parameters from the syntax are explained below:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`value1, value2, ... value_n`}),`: The columns you wish to retrieve. You can also retrieve all the values using the `,_jsx(_components.code,{children:`SELECT * FROM`}),` query.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`table1, table2`}),`: The tables that you wish to retrieve records from.`]}),`\n`]}),`\n`,_jsxs(Tip,{children:[_jsx(_components.strong,{children:`Things to consider:`}),_jsx(`br`,{}),` 1. The data types of corresponding columns in the `,_jsx(_components.code,{children:`SELECT`}),` queries must be compatible. `,_jsx(`br`,{}),` 2. The order of columns is flexible as long as the columns in consecutive places are pairwise compatible.`]}),`\n`,_jsx(Heading,{level:`3`,id:`example-2`,children:`Example`}),`\n`,_jsxs(_components.p,{children:[`Suppose you have two separate tables, `,_jsx(_components.code,{children:`sales_2022`}),` and `,_jsx(_components.code,{children:`sales_2023`}),`, containing sales data for different years. You want to combine the sales data from both tables to get a complete list of sales transactions without removing duplicates.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`21`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`21`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CREATE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` sales_2022`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` transaction_id `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`INT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` product_name `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`TEXT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sale_amount `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`INT`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CREATE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` sales_2023`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` transaction_id `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`INT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` product_name `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`TEXT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sale_amount `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`INT`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`INSERT INTO`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sales_2022 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`VALUES`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Product A'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Product B'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`500`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Product C'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`750`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`INSERT INTO`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sales_2023 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`VALUES`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`4`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Product A'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1200`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Product D'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`800`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`6`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Product E'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`950`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Verifying inserted values by using the `,_jsx(_components.code,{children:`SELECT`}),` statement:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sales_2022;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sales_2023;`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`11`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`transaction_id | product_name | sale_amount`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`----------------+--------------+-------------`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` | Product A | `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1000`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` | Product B | `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`500`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` | Product C | `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`750`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` transaction_id | product_name | sale_amount`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`----------------+--------------+-------------`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 4`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` | Product A | `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1200`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` | Product D | `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`800`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 6`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` | Product E | `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`950`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Let’s combine all values from the tables by using the `,_jsx(_components.code,{children:`UNION ALL`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` product_name, sale_amount `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sales_2022 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`UNION ALL`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` product_name, sale_amount `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sales_2023;`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`In this case, it will display all the values of the first table followed by all the contents of the second table.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`product_name | sale_amount`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`--------------+-------------`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Product A | `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1000`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Product B | `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`500`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Product C | `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`750`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Product A | `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1200`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Product D | `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`800`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Product E | `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`950`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The diagram illustrates that with the `,_jsx(_components.code,{children:`UNION ALL`}),`, all values are displayed, including the duplicate ones. `]}),`\n`,_jsx(OptimizedImage,{className:`mint-block dark:mint-hidden`,src:`https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/light/union/union-two-light.png?fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=771bda62363bc880ed06ab8e92c8314b`,alt:``,\"data-og-width\":`2075`,width:`2075`,\"data-og-height\":`1408`,height:`1408`,\"data-path\":`assets/images/light/union/union-two-light.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/light/union/union-two-light.png?w=280\u0026fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=5f6a02869928f42271b19fa1c136f557 280w, https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/light/union/union-two-light.png?w=560\u0026fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=83e17e8f34e1063a618a71b17c9a01ad 560w, https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/light/union/union-two-light.png?w=840\u0026fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=a04c385054a26088f5af7ce7b41ba04a 840w, https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/light/union/union-two-light.png?w=1100\u0026fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=db00ac8edadc88e2a5628eafba960604 1100w, https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/light/union/union-two-light.png?w=1650\u0026fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=a0e73b5be38a903646bffe35a4c7076c 1650w, https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/light/union/union-two-light.png?w=2500\u0026fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=a44603f7d696e446e46d87d214c2ff3e 2500w`}),`\n`,_jsx(OptimizedImage,{className:`mint-hidden dark:mint-block`,src:`https://mintcdn.com/oxla/scqzK0laaaAr3oxU/assets/images/dark/union/union-two-dark.png?fit=max\u0026auto=format\u0026n=scqzK0laaaAr3oxU\u0026q=85\u0026s=d23377ccb096b06c9542ade314111319`,alt:``,\"data-og-width\":`2075`,width:`2075`,\"data-og-height\":`1408`,height:`1408`,\"data-path\":`assets/images/dark/union/union-two-dark.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/oxla/scqzK0laaaAr3oxU/assets/images/dark/union/union-two-dark.png?w=280\u0026fit=max\u0026auto=format\u0026n=scqzK0laaaAr3oxU\u0026q=85\u0026s=4ff6da8b3883c98302112821526c0764 280w, https://mintcdn.com/oxla/scqzK0laaaAr3oxU/assets/images/dark/union/union-two-dark.png?w=560\u0026fit=max\u0026auto=format\u0026n=scqzK0laaaAr3oxU\u0026q=85\u0026s=130886327af2c0e54b3fbe323135bfce 560w, https://mintcdn.com/oxla/scqzK0laaaAr3oxU/assets/images/dark/union/union-two-dark.png?w=840\u0026fit=max\u0026auto=format\u0026n=scqzK0laaaAr3oxU\u0026q=85\u0026s=1a2a4752c67dab373dfc857be9e7fc95 840w, https://mintcdn.com/oxla/scqzK0laaaAr3oxU/assets/images/dark/union/union-two-dark.png?w=1100\u0026fit=max\u0026auto=format\u0026n=scqzK0laaaAr3oxU\u0026q=85\u0026s=0c71fa7adf0cc2ed9513a887135460bc 1100w, https://mintcdn.com/oxla/scqzK0laaaAr3oxU/assets/images/dark/union/union-two-dark.png?w=1650\u0026fit=max\u0026auto=format\u0026n=scqzK0laaaAr3oxU\u0026q=85\u0026s=c408ae57bdbbd04365f5b201fde91e7c 1650w, https://mintcdn.com/oxla/scqzK0laaaAr3oxU/assets/images/dark/union/union-two-dark.png?w=2500\u0026fit=max\u0026auto=format\u0026n=scqzK0laaaAr3oxU\u0026q=85\u0026s=136084288f3ec81c52b413ac6f5cc2d2 2500w`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"UNION","createdAt":"2023-08-21T16:23:00.375Z","updatedAt":"2023-10-09T13:02:32.129Z","description":null,"href":"/sql-reference/sql-clauses/set-operations/union"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"UNION","slug":"union","depth":2,"children":[{"title":"Overview","slug":"overview","depth":3,"children":[]},{"title":"Syntax","slug":"syntax","depth":3,"children":[]},{"title":"Example","slug":"example","depth":3,"children":[]}]},{"title":"UNION ALL","slug":"union-all","depth":2,"children":[{"title":"Overview","slug":"overview-2","depth":3,"children":[]},{"title":"Syntax","slug":"syntax-2","depth":3,"children":[]},{"title":"Example","slug":"example-2","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":[],"dynamicCss":".mint-block {\n display: block\n}\n.mint-hidden {\n display: none\n}\n.dark\\:mint-block:is(.dark *) {\n display: block\n}\n.dark\\:mint-hidden:is(.dark *) {\n display: none\n}","subdomain":"oxla","siteName":"Oxla Developer Hub","title":"UNION - Oxla Developer Hub","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2025-10-28T08:12:52.006Z","originalFileLocation":"sql-reference/sql-clauses/set-operations/union.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Oxla Developer Hub\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/oxla/NKLUScSyRMjD1PxQ/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/oxla/NKLUScSyRMjD1PxQ/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/oxla/NKLUScSyRMjD1PxQ/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/oxla/NKLUScSyRMjD1PxQ/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/oxla/NKLUScSyRMjD1PxQ/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/oxla/NKLUScSyRMjD1PxQ/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/oxla/NKLUScSyRMjD1PxQ/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/oxla/NKLUScSyRMjD1PxQ/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/oxla/NKLUScSyRMjD1PxQ/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"UNION - Oxla Developer Hub\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Oxla Developer Hub\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.oxla.com/sql-reference/sql-clauses/set-operations/union\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://mintlify.s3-us-west-1.amazonaws.com/oxla/assets/images/light/homepage-img-light.png\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"UNION - Oxla Developer Hub\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://mintlify.s3-us-west-1.amazonaws.com/oxla/assets/images/light/homepage-img-light.png\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/oxla/NKLUScSyRMjD1PxQ/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Oxla Developer Hub\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#EEEEEE\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.oxla.com/sql-reference/sql-clauses/set-operations/union\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sql-reference/sql-clauses/set-operations/union.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.oxla.com/#organization\",\"name\":\"Oxla Developer Hub\",\"url\":\"https://docs.oxla.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/oxla/0Js4fLL2Ovp7KANj/assets/images/logo/logo-light.svg?fit=max\u0026auto=format\u0026n=0Js4fLL2Ovp7KANj\u0026q=85\u0026s=4074307a3716643bc058dc994a8cf42f\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.oxla.com#website\",\"name\":\"Oxla Developer Hub\",\"url\":\"https://docs.oxla.com\",\"publisher\":{\"@id\":\"https://docs.oxla.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.oxla.com/sql-reference/sql-clauses/set-operations/union#webpage\",\"url\":\"https://docs.oxla.com/sql-reference/sql-clauses/set-operations/union\",\"name\":\"UNION\",\"dateModified\":\"2025-10-28T08:12:52.006Z\",\"isPartOf\":{\"@id\":\"https://docs.oxla.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.oxla.com/sql-reference/sql-clauses/set-operations/union#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.oxla.com/sql-reference/sql-clauses/set-operations/union#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Development Guide\",\"item\":\"https://docs.oxla.com/sql-reference/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Reference\",\"item\":\"https://docs.oxla.com/sql-reference/overview\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"SQL Clauses\",\"item\":\"https://docs.oxla.com/sql-reference/sql-clauses/overview\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Set Operations\",\"item\":\"https://docs.oxla.com/sql-reference/sql-clauses/set-operations/overview\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"UNION\",\"item\":\"https://docs.oxla.com/sql-reference/sql-clauses/set-operations/union\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.oxla.com/sql-reference/sql-clauses/set-operations/union#article\",\"headline\":\"UNION\",\"name\":\"UNION\",\"url\":\"https://docs.oxla.com/sql-reference/sql-clauses/set-operations/union\",\"mainEntityOfPage\":{\"@id\":\"https://docs.oxla.com/sql-reference/sql-clauses/set-operations/union#webpage\"},\"image\":\"https://mintlify.s3-us-west-1.amazonaws.com/oxla/assets/images/light/homepage-img-light.png\",\"dateModified\":\"2025-10-28T08:12:52.006Z\",\"publisher\":{\"@id\":\"https://docs.oxla.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.oxla.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Oxla Developer Hub\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Oxla Developer Hub\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/sql-reference/sql-clauses/set-operations/union.md","siteName":"Oxla Developer Hub","nav":{"global":null,"groups":[{"group":"Home","pages":[{"title":"Welcome","href":"/welcome"}]},{"group":"Introduction","pages":[{"title":"What is Oxla and why use it","href":"/introduction/what-is-oxla-and-why-use-it"}]},{"group":"Development Guide","pages":[{"group":"SQL Reference","pages":[{"title":"SQL Reference","sidebarTitle":"Overview","href":"/sql-reference/overview"},{"group":"SQL Statements","pages":[{"title":"SQL STATEMENTS","sidebarTitle":"Overview","href":"/sql-reference/sql-statements/overview"},{"title":"SELECT","href":"/sql-reference/sql-statements/select"},{"title":"INSERT INTO","href":"/sql-reference/sql-statements/insert-into"},{"group":"COPY FROM","pages":[{"title":"COPY FROM","href":"/sql-reference/sql-statements/copy-from/copy-from"},{"title":"COPY FROM with Delimiter","href":"/sql-reference/sql-statements/copy-from/copy-from-with-delimiter"},{"title":"COPY FROM with Endpoint","href":"/sql-reference/sql-statements/copy-from/copy-from-with-endpoint"},{"title":"COPY FROM with HEADER","href":"/sql-reference/sql-statements/copy-from/copy-from-with-header"},{"title":"COPY FROM with NULL","href":"/sql-reference/sql-statements/copy-from/copy-from-with-null"},{"title":"COPY FROM with FORMAT","href":"/sql-reference/sql-statements/copy-from/copy-from-with-format"},{"title":"Importing Data from a CSV file","sidebarTitle":"COPY FROM CSV","href":"/sql-reference/sql-statements/copy-from/copy-from-csv"},{"title":"Importing Data from a ORC file","sidebarTitle":"COPY FROM ORC","href":"/sql-reference/sql-statements/copy-from/copy-from-orc"},{"title":"Importing Data from a Parquet file","sidebarTitle":"COPY FROM PARQUET","href":"/sql-reference/sql-statements/copy-from/copy-from-parquet"},{"title":"COPY FROM STDIN","href":"/sql-reference/sql-statements/copy-from/copy-from-stdin"}]},{"group":"COPY TO","pages":[{"title":"COPY TO","href":"/sql-reference/sql-statements/copy-to/copy-to"},{"title":"Export Data to a CSV file","sidebarTitle":"COPY TO CSV","href":"/sql-reference/sql-statements/copy-to/copy-to-csv"},{"title":"COPY TO with Delimiter","href":"/sql-reference/sql-statements/copy-to/copy-to-with-delimiter"},{"title":"COPY TO with Endpoint","href":"/sql-reference/sql-statements/copy-to/copy-to-with-endpoint"},{"title":"COPY TO with HEADER","href":"/sql-reference/sql-statements/copy-to/copy-to-with-header"},{"title":"COPY TO with NULL","href":"/sql-reference/sql-statements/copy-to/copy-to-with-null"},{"title":"COPY TO STDOUT","href":"/sql-reference/sql-statements/copy-to/copy-to-stdout"}]},{"title":"CREATE INDEX","href":"/sql-reference/sql-statements/create-index"},{"title":"CREATE TABLE","href":"/sql-reference/sql-statements/create-table"},{"title":"DESCRIBE","href":"/sql-reference/sql-statements/describe"},{"title":"DROP","href":"/sql-reference/sql-statements/drop"},{"title":"SET/SHOW","href":"/sql-reference/sql-statements/set-show"},{"title":"SHOW TABLES","href":"/sql-reference/sql-statements/show-tables"},{"title":"SHOW NODES","href":"/sql-reference/sql-statements/show-nodes"},{"title":"Keywords","href":"/sql-reference/sql-statements/keywords"}]},{"group":"SQL Mutations","pages":[{"title":"SQL MUTATIONS","sidebarTitle":"Overview","href":"/sql-reference/sql-mutations/overview"},{"title":"UPDATE","href":"/sql-reference/sql-mutations/update"},{"title":"DELETE","href":"/sql-reference/sql-mutations/delete"}]},{"group":"SQL Clauses","pages":[{"title":"SQL CLAUSES","sidebarTitle":"Overview","href":"/sql-reference/sql-clauses/overview"},{"group":"FROM","pages":[{"title":"FROM","href":"/sql-reference/sql-clauses/from/from"},{"title":"JOIN","href":"/sql-reference/sql-clauses/from/join"},{"title":"LEFT JOIN","href":"/sql-reference/sql-clauses/from/left-join"},{"title":"OUTER JOIN","href":"/sql-reference/sql-clauses/from/outer-join"},{"title":"RIGHT JOIN","href":"/sql-reference/sql-clauses/from/right-join"}]},{"title":"WHERE","href":"/sql-reference/sql-clauses/where"},{"title":"GROUP BY","href":"/sql-reference/sql-clauses/group-by"},{"title":"HAVING","href":"/sql-reference/sql-clauses/having"},{"title":"ORDER BY","href":"/sql-reference/sql-clauses/order-by"},{"title":"LIMIT","href":"/sql-reference/sql-clauses/limit"},{"title":"OFFSET","href":"/sql-reference/sql-clauses/offset"},{"group":"Set Operations","pages":[{"title":"Overview","href":"/sql-reference/sql-clauses/set-operations/overview"},{"title":"EXCEPT","href":"/sql-reference/sql-clauses/set-operations/except"},{"title":"INTERSECT","description":null,"href":"/sql-reference/sql-clauses/set-operations/intersect"},{"title":"UNION","href":"/sql-reference/sql-clauses/set-operations/union"}]},{"title":"WITH","description":null,"href":"/sql-reference/sql-clauses/with"},{"title":"OVER / WINDOW","href":"/sql-reference/sql-clauses/over-window"}]},{"group":"SQL Data Types","pages":[{"title":"SQL DATA TYPES","sidebarTitle":"Overview","href":"/sql-reference/sql-data-types/overview"},{"title":"Data Type Operators","href":"/sql-reference/sql-data-types/data-type-operators"},{"group":"Numeric","pages":[{"title":"Numeric","href":"/sql-reference/sql-data-types/numeric-type/numeric"},{"title":"Numeric Data Type - Aliases","href":"/sql-reference/sql-data-types/numeric-type/numeric-data-type-aliases"}]},{"title":"Timestamp Without Time Zone","href":"/sql-reference/sql-data-types/timestamp-without-time-zone"},{"title":"Timestamp with Time Zone","href":"/sql-reference/sql-data-types/timestamp-with-time-zone"},{"title":"Date","href":"/sql-reference/sql-data-types/date"},{"group":"Time","pages":[{"title":"Time","href":"/sql-reference/sql-data-types/time-type/time"},{"title":"Time Operators","href":"/sql-reference/sql-data-types/time-type/time-operators"}]},{"title":"Interval","href":"/sql-reference/sql-data-types/interval"},{"title":"Bool","href":"/sql-reference/sql-data-types/bool"},{"title":"Text","href":"/sql-reference/sql-data-types/text"},{"title":"JSON","href":"/sql-reference/sql-data-types/json"},{"title":"Array","href":"/sql-reference/sql-data-types/array"}]},{"group":"SQL Functions","pages":[{"title":"SQL Functions","sidebarTitle":"Overview","href":"/sql-reference/sql-functions/overview"},{"group":"Boolean","pages":[{"title":"IF Function","href":"/sql-reference/sql-functions/boolean-functions/if-function"},{"title":"IS DISTINCT FROM Operator","href":"/sql-reference/sql-functions/boolean-functions/is-distinct-from-operator"},{"title":"IS NOT DISTINCT FROM Operator","href":"/sql-reference/sql-functions/boolean-functions/is-not-distinct-from-operator"}]},{"group":"Math","pages":[{"title":"Overview","href":"/sql-reference/sql-functions/math-functions/overview"},{"title":"ABS","href":"/sql-reference/sql-functions/math-functions/abs"},{"title":"CBRT","href":"/sql-reference/sql-functions/math-functions/cbrt"},{"title":"CEIL","href":"/sql-reference/sql-functions/math-functions/ceil"},{"title":"EXP","href":"/sql-reference/sql-functions/math-functions/exp"},{"title":"FLOOR","href":"/sql-reference/sql-functions/math-functions/floor"},{"title":"GREATEST","href":"/sql-reference/sql-functions/math-functions/greatest"},{"title":"LEAST","href":"/sql-reference/sql-functions/math-functions/least"},{"title":"LN","href":"/sql-reference/sql-functions/math-functions/ln"},{"title":"LOG","href":"/sql-reference/sql-functions/math-functions/log"},{"title":"POWER","href":"/sql-reference/sql-functions/math-functions/power"},{"title":"RANDOM","href":"/sql-reference/sql-functions/math-functions/random"},{"title":"ROUND","href":"/sql-reference/sql-functions/math-functions/round"},{"title":"SIGN","href":"/sql-reference/sql-functions/math-functions/sign"},{"title":"SIN","href":"/sql-reference/sql-functions/math-functions/sin"},{"title":"SQRT","href":"/sql-reference/sql-functions/math-functions/sqrt"},{"title":"BITWISE SHIFT LEFT","sidebarTitle":"BITWISE SHIFT LEFT","href":"/sql-reference/sql-functions/math-functions/bitwise-shift-left"},{"title":"BITWISE SHIFT RIGHT","sidebarTitle":"BITWISE SHIFT RIGHT","href":"/sql-reference/sql-functions/math-functions/bitwise-shift-right"},{"title":"TO_CHAR from Number","href":"/sql-reference/sql-functions/math-functions/to-char-from-number"}]},{"group":"String","pages":[{"title":"Overview","href":"/sql-reference/sql-functions/string-functions/overview"},{"title":"CONCAT","href":"/sql-reference/sql-functions/string-functions/concat"},{"title":"ENDS_WITH","href":"/sql-reference/sql-functions/string-functions/ends-with"},{"title":"LENGTH","href":"/sql-reference/sql-functions/string-functions/length"},{"title":"LOWER","href":"/sql-reference/sql-functions/string-functions/lower"},{"group":"Regex","pages":[{"title":"REGEXP_REPLACE()","sidebarTitle":"REGEXP_REPLACE","href":"/sql-reference/sql-functions/string-functions/regex/regexp-replace"},{"title":"REGEXP_MATCH()","sidebarTitle":"REGEXP_MATCH","href":"/sql-reference/sql-functions/string-functions/regex/regexp-match"},{"title":"POSIX Regular Expressions","href":"/sql-reference/sql-functions/string-functions/regex/posix-regular-expressions"}]},{"title":"REPLACE()","sidebarTitle":"REPLACE","href":"/sql-reference/sql-functions/string-functions/replace"},{"title":"STARTS_WITH","href":"/sql-reference/sql-functions/string-functions/starts-with"},{"title":"STRPOS","href":"/sql-reference/sql-functions/string-functions/strpos"},{"title":"SUBSTR","href":"/sql-reference/sql-functions/string-functions/substr"},{"title":"SUBSTRING","href":"/sql-reference/sql-functions/string-functions/substring"},{"title":"UPPER","href":"/sql-reference/sql-functions/string-functions/upper"},{"title":"POSITION","href":"/sql-reference/sql-functions/string-functions/position"}]},{"group":"Timestamp","pages":[{"title":"Overview","href":"/sql-reference/sql-functions/timestamp-functions/overview"},{"title":"CURRENT_TIMESTAMP","href":"/sql-reference/sql-functions/timestamp-functions/current-timestamp"},{"title":"DATE_TRUNC","href":"/sql-reference/sql-functions/timestamp-functions/date-trunc"},{"title":"EXTRACT","href":"/sql-reference/sql-functions/timestamp-functions/extract"},{"title":"FORMAT_TIMESTAMP","href":"/sql-reference/sql-functions/timestamp-functions/format-timestamp"},{"title":"TIMESTAMP_MICROS","href":"/sql-reference/sql-functions/timestamp-functions/timestamp-micros"},{"title":"TIMESTAMP_MILLIS","href":"/sql-reference/sql-functions/timestamp-functions/timestamp-millis"},{"title":"TIMESTAMP_SECONDS","href":"/sql-reference/sql-functions/timestamp-functions/timestamp-seconds"},{"title":"TIMESTAMP_TRUNC","href":"/sql-reference/sql-functions/timestamp-functions/timestamp-trunc"},{"title":"TO_CHAR","href":"/sql-reference/sql-functions/timestamp-functions/to-char"},{"title":"TO_TIMESTAMP","href":"/sql-reference/sql-functions/timestamp-functions/to-timestamp"},{"title":"UNIX_MICROS","href":"/sql-reference/sql-functions/timestamp-functions/unix-macros"},{"title":"UNIX_MICROS","href":"/sql-reference/sql-functions/timestamp-functions/unix-micros"},{"title":"UNIX_MILLIS","href":"/sql-reference/sql-functions/timestamp-functions/unix-millis"},{"title":"UNIX_SECONDS","href":"/sql-reference/sql-functions/timestamp-functions/unix-seconds"}]},{"group":"Trigonometric","pages":[{"title":"Trigonometric Functions","href":"/sql-reference/sql-functions/trigonometric-functions/overview"}]},{"group":"JSON","pages":[{"title":"Overview","href":"/sql-reference/sql-functions/json-functions/overview"},{"title":"JSON_ARRAY_EXTRACT","href":"/sql-reference/sql-functions/json-functions/json-array-extract"},{"title":"JSON_ARRAY_LENGTH","href":"/sql-reference/sql-functions/json-functions/json-array-length"},{"title":"JSON_EXTRACT_PATH","href":"/sql-reference/sql-functions/json-functions/json-extract-path"},{"title":"JSON_EXTRACT_PATH_TEXT","href":"/sql-reference/sql-functions/json-functions/json-extract-path-text"}]},{"group":"Aggregate","pages":[{"title":"Overview","href":"/sql-reference/sql-functions/aggregate-functions/overview"},{"group":"Statistics","pages":[{"title":"Overview","href":"/sql-reference/sql-functions/aggregate-functions/overview-statistics"},{"title":"CORR()","sidebarTitle":"CORR","href":"/sql-reference/sql-functions/aggregate-functions/corr"},{"title":"COVAR_POP()","sidebarTitle":"COVAR_POP","href":"/sql-reference/sql-functions/aggregate-functions/covar-pop"},{"title":"COVAR_SAMP","href":"/sql-reference/sql-functions/aggregate-functions/covar-samp"},{"title":"REGR_AVGX()","sidebarTitle":"REGR_AVGX","href":"/sql-reference/sql-functions/aggregate-functions/regr-avgx"},{"title":"REGR_AVGY()","sidebarTitle":"REGR_AVGY","href":"/sql-reference/sql-functions/aggregate-functions/regr-avgy"},{"title":"REGR_COUNT()","sidebarTitle":"REGR_COUNT","href":"/sql-reference/sql-functions/aggregate-functions/regr-count"},{"title":"REGR_INTERCEPT()","sidebarTitle":"REGR_INTERCEPT","href":"/sql-reference/sql-functions/aggregate-functions/regr-intercept"},{"title":"REGR_R2()","sidebarTitle":"REGR_R2","href":"/sql-reference/sql-functions/aggregate-functions/regr-r2"},{"title":"REGR_SLOPE()","sidebarTitle":"REGR_SLOPE","href":"/sql-reference/sql-functions/aggregate-functions/regr-slope"},{"title":"REGR_SXX()","sidebarTitle":"REGR_SXX","href":"/sql-reference/sql-functions/aggregate-functions/regr-sxx"},{"title":"REGR_SXY()","sidebarTitle":"REGR_SXY","href":"/sql-reference/sql-functions/aggregate-functions/regr-sxy"},{"title":"REGR_SYY()","sidebarTitle":"REGR_SYY","href":"/sql-reference/sql-functions/aggregate-functions/regr-syy"},{"title":"STDDEV()","sidebarTitle":"STDDEV","href":"/sql-reference/sql-functions/aggregate-functions/stddev"},{"title":"STDDEV_POP()","sidebarTitle":"STDDEV_POP","href":"/sql-reference/sql-functions/aggregate-functions/stddev-pop"},{"title":"STDDEV_SAMP()","sidebarTitle":"STDDEV_SAMP","href":"/sql-reference/sql-functions/aggregate-functions/stddev-samp"},{"title":"VARIANCE()","sidebarTitle":"VARIANCE","href":"/sql-reference/sql-functions/aggregate-functions/variance"},{"title":"VAR_POP()","sidebarTitle":"VAR_POP","href":"/sql-reference/sql-functions/aggregate-functions/var-pop"},{"title":"VAR_SAMP()","sidebarTitle":"VAR_SAMP","href":"/sql-reference/sql-functions/aggregate-functions/var-samp"}]},{"group":"Ordered-Set","pages":[{"title":"MODE()","sidebarTitle":"MODE","href":"/sql-reference/sql-functions/aggregate-functions/ordered-set-aggregate-functions/mode"},{"title":"PERCENTILE_CONT()","sidebarTitle":"PERCENTILE_CONT","href":"/sql-reference/sql-functions/aggregate-functions/ordered-set-aggregate-functions/percentile-cont"},{"title":"PERCENTILE_DISC()","sidebarTitle":"PERCENTILE_DISC","href":"/sql-reference/sql-functions/aggregate-functions/ordered-set-aggregate-functions/percentile-disc"}]},{"title":"AVG","href":"/sql-reference/sql-functions/aggregate-functions/avg"},{"title":"BOOL_AND","href":"/sql-reference/sql-functions/aggregate-functions/bool-and"},{"title":"BOOL_OR","href":"/sql-reference/sql-functions/aggregate-functions/bool-or"},{"title":"COUNT","href":"/sql-reference/sql-functions/aggregate-functions/count"},{"title":"FOR_MAX()","sidebarTitle":"FOR_MAX","href":"/sql-reference/sql-functions/aggregate-functions/for-max"},{"title":"FOR_MIN()","sidebarTitle":"FOR_MIN","href":"/sql-reference/sql-functions/aggregate-functions/for-min"},{"title":"MAX","href":"/sql-reference/sql-functions/aggregate-functions/max"},{"title":"MIN","href":"/sql-reference/sql-functions/aggregate-functions/min"},{"title":"SUM","href":"/sql-reference/sql-functions/aggregate-functions/sum"},{"title":"DISTINCT","href":"/sql-reference/sql-functions/aggregate-functions/distinct"}]},{"group":"Window","pages":[{"title":"Overview","href":"/sql-reference/sql-functions/window-functions/overview"},{"title":"COUNT()","sidebarTitle":"COUNT","href":"/sql-reference/sql-functions/window-functions/count"},{"title":"DENSE_RANK()","sidebarTitle":"DENSE_RANK","href":"/sql-reference/sql-functions/window-functions/dense-rank"},{"title":"RANK()","sidebarTitle":"RANK","href":"/sql-reference/sql-functions/window-functions/rank"},{"title":"ROW_NUMBER","href":"/sql-reference/sql-functions/window-functions/row-number"},{"title":"AVG()","sidebarTitle":"AVG","href":"/sql-reference/sql-functions/window-functions/avg"},{"title":"BOOL_AND()","sidebarTitle":"BOOL_AND","href":"/sql-reference/sql-functions/window-functions/bool-and"},{"title":"BOOL_OR()","sidebarTitle":"BOOL_OR","href":"/sql-reference/sql-functions/window-functions/bool-or"},{"title":"CUME_DIST()","sidebarTitle":"CUME_DIST","href":"/sql-reference/sql-functions/window-functions/cume-dist"},{"title":"FIRST_VALUE()","sidebarTitle":"FIRST_VALUE","href":"/sql-reference/sql-functions/window-functions/first-value"},{"title":"LAG()","sidebarTitle":"LAG","href":"/sql-reference/sql-functions/window-functions/lag"},{"title":"LAST_VALUE()","sidebarTitle":"LAST_VALUE","href":"/sql-reference/sql-functions/window-functions/last-value"},{"title":"LEAD()","sidebarTitle":"LEAD","href":"/sql-reference/sql-functions/window-functions/lead"},{"title":"MAX()","sidebarTitle":"MAX","href":"/sql-reference/sql-functions/window-functions/max"},{"title":"MIN()","sidebarTitle":"MIN","href":"/sql-reference/sql-functions/window-functions/min"},{"title":"NTH_VALUE()","sidebarTitle":"NTH_VALUE","href":"/sql-reference/sql-functions/window-functions/nth-value"},{"title":"NTILE()","sidebarTitle":"NTILE","href":"/sql-reference/sql-functions/window-functions/ntile"},{"title":"PERCENT_RANK()","sidebarTitle":"PERCENT_RANK","href":"/sql-reference/sql-functions/window-functions/percent-rank"},{"title":"SUM()","sidebarTitle":"SUM","href":"/sql-reference/sql-functions/window-functions/sum"}]},{"group":"String","pages":[{"group":"REGEX","pages":[{"title":"REGEXP_REPLACE()","sidebarTitle":"REGEXP_REPLACE","href":"/sql-reference/sql-functions/string-functions/regex/regexp-replace"},{"title":"REGEXP_MATCH()","sidebarTitle":"REGEXP_MATCH","href":"/sql-reference/sql-functions/string-functions/regex/regexp-match"},{"title":"POSIX Regular Expressions","href":"/sql-reference/sql-functions/string-functions/regex/posix-regular-expressions"}]},{"title":"Overview","href":"/sql-reference/sql-functions/string-functions/overview"},{"title":"CONCAT","href":"/sql-reference/sql-functions/string-functions/concat"},{"title":"ENDS_WITH","href":"/sql-reference/sql-functions/string-functions/ends-with"},{"title":"LENGTH","href":"/sql-reference/sql-functions/string-functions/length"},{"title":"LOWER","href":"/sql-reference/sql-functions/string-functions/lower"},{"title":"REPLACE()","sidebarTitle":"REPLACE","href":"/sql-reference/sql-functions/string-functions/replace"},{"title":"STARTS_WITH","href":"/sql-reference/sql-functions/string-functions/starts-with"},{"title":"STRPOS","href":"/sql-reference/sql-functions/string-functions/strpos"},{"title":"SUBSTR","href":"/sql-reference/sql-functions/string-functions/substr"},{"title":"SUBSTRING","href":"/sql-reference/sql-functions/string-functions/substring"},{"title":"UPPER","href":"/sql-reference/sql-functions/string-functions/upper"},{"title":"POSITION","href":"/sql-reference/sql-functions/string-functions/position"}]},{"group":"Timestamp","pages":[{"title":"Overview","href":"/sql-reference/sql-functions/timestamp-functions/overview"},{"title":"CURRENT_TIMESTAMP","href":"/sql-reference/sql-functions/timestamp-functions/current-timestamp"},{"title":"DATE_TRUNC","href":"/sql-reference/sql-functions/timestamp-functions/date-trunc"},{"title":"EXTRACT","href":"/sql-reference/sql-functions/timestamp-functions/extract"},{"title":"FORMAT_TIMESTAMP","href":"/sql-reference/sql-functions/timestamp-functions/format-timestamp"},{"title":"TIMESTAMP_MICROS","href":"/sql-reference/sql-functions/timestamp-functions/timestamp-micros"},{"title":"TIMESTAMP_MILLIS","href":"/sql-reference/sql-functions/timestamp-functions/timestamp-millis"},{"title":"TIMESTAMP_SECONDS","href":"/sql-reference/sql-functions/timestamp-functions/timestamp-seconds"},{"title":"TIMESTAMP_TRUNC","href":"/sql-reference/sql-functions/timestamp-functions/timestamp-trunc"},{"title":"TO_CHAR","href":"/sql-reference/sql-functions/timestamp-functions/to-char"},{"title":"TO_TIMESTAMP","href":"/sql-reference/sql-functions/timestamp-functions/to-timestamp"},{"title":"UNIX_MICROS","href":"/sql-reference/sql-functions/timestamp-functions/unix-macros"},{"title":"UNIX_MICROS","href":"/sql-reference/sql-functions/timestamp-functions/unix-micros"},{"title":"UNIX_MILLIS","href":"/sql-reference/sql-functions/timestamp-functions/unix-millis"},{"title":"UNIX_SECONDS","href":"/sql-reference/sql-functions/timestamp-functions/unix-seconds"}]},{"group":"Boolean","pages":[{"title":"IF Function","href":"/sql-reference/sql-functions/boolean-functions/if-function"},{"title":"IS DISTINCT FROM Operator","href":"/sql-reference/sql-functions/boolean-functions/is-distinct-from-operator"},{"title":"IS NOT DISTINCT FROM Operator","href":"/sql-reference/sql-functions/boolean-functions/is-not-distinct-from-operator"}]},{"group":"JSON","pages":[{"title":"Overview","href":"/sql-reference/sql-functions/json-functions/overview"},{"title":"JSON_ARRAY_EXTRACT","href":"/sql-reference/sql-functions/json-functions/json-array-extract"},{"title":"JSON_ARRAY_LENGTH","href":"/sql-reference/sql-functions/json-functions/json-array-length"},{"title":"JSON_EXTRACT_PATH","href":"/sql-reference/sql-functions/json-functions/json-extract-path"},{"title":"JSON_EXTRACT_PATH_TEXT","href":"/sql-reference/sql-functions/json-functions/json-extract-path-text"}]},{"group":"Other","pages":[{"title":"Overview","href":"/sql-reference/sql-functions/other-functions/overview"},{"title":"coalesce()","sidebarTitle":"coalesce","href":"/sql-reference/sql-functions/other-functions/coalesce"},{"title":"current_database()","sidebarTitle":"current_database","href":"/sql-reference/sql-functions/other-functions/current-database"},{"title":"current_schema()","sidebarTitle":"current_schema","href":"/sql-reference/sql-functions/other-functions/current-schema"},{"title":"has_schema_privilege()","sidebarTitle":"has_schema_privilege","href":"/sql-reference/sql-functions/other-functions/has-schema-privillege"},{"title":"nullif()","sidebarTitle":"nullif","href":"/sql-reference/sql-functions/other-functions/nullif"},{"title":"pg_get_expr()","sidebarTitle":"pg_get_expr","href":"/sql-reference/sql-functions/other-functions/pg-get-expr"},{"title":"pg_total_relation_size()","sidebarTitle":"pg_total_relation_size","href":"/sql-reference/sql-functions/other-functions/pg-total-relation-size"},{"title":"pg_typeof()","sidebarTitle":"pg_typeof","href":"/sql-reference/sql-functions/other-functions/pg-typeof"},{"title":"col_description()","sidebarTitle":"col_description","href":"/sql-reference/sql-functions/other-functions/col-description"},{"title":"pg_get_constraintdef()","sidebarTitle":"pg_get_constraintdef","href":"/sql-reference/sql-functions/other-functions/pg-get-constraintdef"},{"title":"pg_table_is_visible()","sidebarTitle":"pg_table_is_visible","href":"/sql-reference/sql-functions/other-functions/pg-table-is-visible"},{"title":"pg_size_pretty()","sidebarTitle":"pg_size_pretty","href":"/sql-reference/sql-functions/other-functions/pg-size-pretty"},{"title":"obj_description()","sidebarTitle":"obj_description","href":"/sql-reference/sql-functions/other-functions/obj-description"},{"title":"pg_table_size()","sidebarTitle":"pg_table_size","href":"/sql-reference/sql-functions/other-functions/pg-table-size"},{"title":"pg_get_indexdef()","sidebarTitle":"pg_get_indexdef","href":"/sql-reference/sql-functions/other-functions/pg-get-indexdef"},{"title":"shobj_description()","sidebarTitle":"shobj_description","href":"/sql-reference/sql-functions/other-functions/shobj-description"},{"title":"pg_backend_pid()","sidebarTitle":"pg_backend_pid","href":"/sql-reference/sql-functions/other-functions/pg-backend-pid"},{"title":"pg_encoding_to_char()","sidebarTitle":"pg_encoding_to_char","href":"/sql-reference/sql-functions/other-functions/pg-encoding-to-char"},{"title":"pg_relation_is_publishable()","sidebarTitle":"pg_relation_is_publishable","href":"/sql-reference/sql-functions/other-functions/pg-relation-is-publishable"},{"title":"pg_get_userbyid()","sidebarTitle":"pg_get_userbyid","href":"/sql-reference/sql-functions/other-functions/pg-get-userbyid"},{"title":"pg_get_statisticsobjdef_columns()","sidebarTitle":"pg_get_statisticsobjdef_columns","href":"/sql-reference/sql-functions/other-functions/pg-get-statisticsobjdef-columns"}]},{"group":"Trigonometric","pages":[{"title":"Trigonometric Functions","href":"/sql-reference/sql-functions/trigonometric-functions/overview"}]}]},{"title":"Schema Definition","href":"/sql-reference/schema"},{"title":"Comment Support","href":"/sql-reference/comment-support"},{"title":"Transactions","href":"/sql-reference/transactions"}]},{"group":"Clients \u0026 Tools","pages":[{"group":"Language Clients","pages":[{"title":"C# (Dapper - Npgsql)","href":"/clients-tools/language-clients/dotnet-dapper"},{"title":"Java (JDBC)","href":"/clients-tools/language-clients/java-jdbc"},{"title":"PHP (PDO)","href":"/clients-tools/language-clients/php-pdo"},{"title":"Psycopg2","href":"/clients-tools/language-clients/psycopg2"}]}]},{"group":"Security","pages":[{"title":"Access Control","sidebarTitle":"Access Control","href":"/security/access-control"},{"title":"Roles","href":"/security/roles"},{"title":"Ownership","href":"/security/ownership"},{"title":"Privileges","href":"/security/privileges"},{"title":"Permission Rules for Operations","href":"/security/operation-permission-rules"},{"title":"SSL Configuration","href":"/security/ssl-configuration"}]},{"group":"System Catalogs","pages":[{"title":"Overview","href":"/system-catalogs/overview"},{"title":"Oxla Home Files","href":"/system-catalogs/oxla_home_files"},{"title":"Data Task Stability","href":"/system-catalogs/data_task_stability"},{"group":"Catalogs","pages":[{"title":"pg_description","href":"/system-catalogs/catalogs/pg_description"},{"title":"pg_settings","href":"/system-catalogs/catalogs/pg_settings"},{"title":"pg_index","href":"/system-catalogs/catalogs/pg_index"},{"title":"pg_namespace","href":"/system-catalogs/catalogs/pg_namespace"},{"title":"pg_attrdef","href":"/system-catalogs/catalogs/pg_attrdef"},{"title":"pg_depend","href":"/system-catalogs/catalogs/pg_depend"},{"title":"pg_constraint","href":"/system-catalogs/catalogs/pg_constraint"},{"title":"pg_statio_user_tables","href":"/system-catalogs/catalogs/pg_statio_user_tables"},{"title":"pg_type","href":"/system-catalogs/catalogs/pg_type"},{"title":"pg_attribute","href":"/system-catalogs/catalogs/pg_attribute"},{"title":"pg_class","href":"/system-catalogs/catalogs/pg_class"}]}]},{"group":"Troubleshooting \u0026 Optimization","pages":[{"title":"Error Handling","href":"/troubleshooting-optimization/error-handling"},{"title":"Degraded State Handling","href":"/troubleshooting-optimization/degraded-state-handling"}]}]},{"group":"Resources","pages":[{"title":"OLTP vs. OLAP","href":"/resources/oltp-vs-olap"},{"title":"Oxla vs. PostgreSQL","href":"/resources/oxla-vs-postgresql"}]}]},"basePath":"","title":"UNION - Oxla Developer Hub","deploymentId":"dpl_DyXGnKeCjZyA3sUdfMJ7FjkdBefg","buildId":"dpl_DyXGnKeCjZyA3sUdfMJ7FjkdBefg","dynamics":["10e4515597","a74be98ba7"],"chunks":["BannerMarkdown-BOAJk9BH.js","dist-Dl6_zDnT.js","lib-DMeTj1gb.js","lib-B8HbPgcC.js","katex-Dbtb6Wk7.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js","zoom-image-lightbox-BQ4tbj_9.js","lightbox-handle-r17bVUz3.js"]}