{"id":798,"date":"2019-12-04T10:25:10","date_gmt":"2019-12-04T04:55:10","guid":{"rendered":"https:\/\/binaryterms.com\/?p=798"},"modified":"2021-01-18T12:41:10","modified_gmt":"2021-01-18T07:11:10","slug":"set-operations-in-sql","status":"publish","type":"post","link":"https:\/\/binaryterms.com\/set-operations-in-sql.html","title":{"rendered":"Set Operations in SQL"},"content":{"rendered":"<p><strong>Set operations<\/strong> integrate the outcome of two entirely independent SQL queries. There are three set operations in SQL <strong>Union<\/strong>, <strong>Intersect<\/strong>, <strong>Except<\/strong>. These set operations are based on the principles of <strong>mathematical set theory.<\/strong> The set operations are applicable to the <strong>type compatible<\/strong> relations only, that means relations involved in operation must have an &#8216;equal number of attributes&#8217; and they must have the &#8216;same attribute domains&#8217;. This is also called <strong>union compatibility<\/strong>.<\/p>\n<p>The queries that are integrated using set operators are termed as <strong>compound<\/strong> <strong>queries<\/strong>. If we consider variations, there are two variations of the set operations. First variation; the set operations Union, Intersection &amp; Except are applied to the <strong>traditional sets<\/strong> and its outcome <strong>do not<\/strong> have any <strong>duplicate<\/strong> records in it. Second variation; the set operation Union All, Intersection All &amp; Except All are applied to the <strong>multisets<\/strong> and its outcome have <strong>duplicates <\/strong>record in it.<\/p>\n<p>The two set operations &#8216;Union&#8217; and &#8216;Intersection&#8217; are <strong>commutative<\/strong> that means they exhibit the same result irrespective of the order of the operands. While the &#8216;Except&#8217; set operation is <strong>not commutative<\/strong>. The Union, Intersection and Except are the binary operations so, they operate only two operands for evaluating the result.<\/p>\n<h3>Set Operations in DBMS:<\/h3>\n<ol>\n<li><a href=\"#Union\">Union<\/a><\/li>\n<li><a href=\"#UnionAll\">Union All<\/a><\/li>\n<li><a href=\"#Intersect\">Intersect<\/a><\/li>\n<li><a href=\"#IntersectAll\">Intersect All<\/a><\/li>\n<li><a href=\"#Except\">Except<\/a><\/li>\n<li><a href=\"#ExceptAll\">Except All<\/a><\/li>\n<\/ol>\n<p><a name=\"Union\"><\/a><\/p>\n<h3>1. Union Set Operations<\/h3>\n<p><strong>Union<\/strong> set operation is the binary operation that unites the results of two independent select queries. The outcome of Union operation has the records that are <strong>either present in its first operand or in the second operand<\/strong>. The outcome of the Union operation <strong>does not<\/strong> have any <strong>duplicates<\/strong>. The union operation is <strong>commutative<\/strong> in nature so, the order of the input to union operator does not vary the result.<\/p>\n<p>Let us take an example to understand the Union set operation. Suppose, we have a &#8216;Section&#8217; relation as you can see below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-804 size-full\" src=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Section-Relation-in-database.jpg\" alt=\"Section-Relation in database\" width=\"476\" height=\"604\" srcset=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Section-Relation-in-database.jpg 476w, https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Section-Relation-in-database-236x300.jpg 236w\" sizes=\"auto, (max-width: 476px) 100vw, 476px\" \/><\/p>\n<p>And we want to discover the set of all the courses that were taught either in Fall &#8216;2018&#8217; or in Spring &#8216;2019&#8217;. The query for this would be:<\/p>\n<p style=\"text-align: center\"><em>(<strong>select<\/strong> Course-id <\/em><br \/>\n<em><strong>from<\/strong> Section <\/em><br \/>\n<em><strong>where<\/strong> Semester=\u2018Fall\u2019 <strong>and<\/strong> year=2018)<\/em><br \/>\n<em><strong>union<br \/>\n<\/strong>(<strong>select<\/strong> Course-id<\/em><br \/>\n<em><strong>from<\/strong> Section<\/em><br \/>\n<em><strong>where<\/strong> Semester=\u2018Spring\u2019 <strong>and<\/strong> year=2019);<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-807 size-full\" src=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Union-Operation.jpg\" alt=\"Union-Operation\" width=\"355\" height=\"361\" srcset=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Union-Operation.jpg 355w, https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Union-Operation-295x300.jpg 295w\" sizes=\"auto, (max-width: 355px) 100vw, 355px\" \/><\/p>\n<p>Observe the result above, it has a set of course-ids that were taught either in &#8216;Fall&#8217; 2018 or in &#8216;Spring&#8217; 2019. The result has eliminated the duplicate record such as course-id CS-101 has been taught in &#8216;Fall&#8217; 2018 as well as &#8216;Spring&#8217; 2019 still, it appear only once. The course-id CS-319 has also been taught in two sections 1 &amp; 2 in Spring 2019 but, here also duplicate has been eliminated and the course-id CS-319 appear only once.<br \/>\n<a name=\"UnionAll\"><\/a><\/p>\n<h3>2. Union All Set Operation<\/h3>\n<p><strong>Union all<\/strong> is a variation of Union set operation. Instead of eliminating the duplicates like Union, it <strong>retains<\/strong> all the <strong>duplicates<\/strong> in the result. Let us take the same example as above but now with union all set operation. The query below will evaluate the course-ids that were taught in either in &#8216;Fall&#8217; 2018 or in &#8216;Spring&#8217; 2019.<\/p>\n<p style=\"text-align: center\"><em>(<strong>select<\/strong> Course-id <\/em><br \/>\n<em><strong>from<\/strong> Section <\/em><br \/>\n<em><strong>where<\/strong> Semester=\u2018Fall\u2019 <strong>and<\/strong> year=2018)<\/em><br \/>\n<em><strong>union all<br \/>\n<\/strong>(<strong>select<\/strong> Course-id<\/em><br \/>\n<em><strong>from<\/strong> Section<\/em><br \/>\n<em><strong>where<\/strong> Semester=\u2018Spring\u2019 <strong>and<\/strong> year=2019);<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-808 size-full\" src=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Set-operation-Union-all.jpg\" alt=\"Set operation Union all\" width=\"392\" height=\"409\" srcset=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Set-operation-Union-all.jpg 392w, https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Set-operation-Union-all-288x300.jpg 288w\" sizes=\"auto, (max-width: 392px) 100vw, 392px\" \/><\/p>\n<p>Observe the result above, two course-ids CS-101 and CS-319 that were eliminated in the union operation, appears twice in the result. In this way, the outcome of union all operation has the tuples that are in both the operands and it also preserves the duplicates.<br \/>\n<a name=\"Intersect\"><\/a><\/p>\n<h3>3. Intersect Set Operations<\/h3>\n<p>Intersection (Intersect) operation is a binary operation whose outcome has the set of tuples that are present in <strong>both<\/strong> the relations included in the intersection operation. Interest operation eliminates the duplicates from the result.<\/p>\n<p>Like the union, intersection operation is also commutative. So, the order of the relations involved in the intersection operation doesn\u2019t vary the result. To understand the intersection operation clearly we will apply the intersection operation to the above example.<\/p>\n<p>So here, we want the list of all the courses that were taught in &#8216;Fall&#8217; 2018 <strong>as well as<\/strong> &#8216;Spring&#8217; 2019. The query for the same would be as below:<\/p>\n<p style=\"text-align: center\"><em>(<strong>select<\/strong> Course-id <\/em><br \/>\n<em><strong>from<\/strong> Section <\/em><br \/>\n<em><strong>where<\/strong> Semester=\u2018Fall\u2019 <strong>and<\/strong> year=2018)<\/em><br \/>\n<em><strong>intersect<br \/>\n<\/strong>(<strong>select<\/strong> Course-id<\/em><br \/>\n<em><strong>from<\/strong> Section<\/em><br \/>\n<em><strong>where<\/strong> Semester=\u2018Spring\u2019 <strong>and<\/strong> year=2019);<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-809 size-full\" src=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Set-operation-Intersection.jpg\" alt=\"Set operation Intersection\" width=\"332\" height=\"113\" srcset=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Set-operation-Intersection.jpg 332w, https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Set-operation-Intersection-300x102.jpg 300w\" sizes=\"auto, (max-width: 332px) 100vw, 332px\" \/><\/p>\n<p>There is only one course CS-101 that was taught in Fall 2018 and in Spring 2019.<br \/>\n<a name=\"IntersectAll\"><\/a><\/p>\n<h3>4. Intersect All Set Operation<\/h3>\n<p>Intersect all operation is a variation of &#8216;intersect&#8217; operation. Despite of eliminating the duplicates Intersect all operation retains them in the result. So, if you want the set of all the courses that were taught in Fall 2018 a<strong>s well as<\/strong> in Spring 2019. Then the query for this using Intersect all is as below:<\/p>\n<p style=\"text-align: center\"><em>(<strong>select<\/strong> Course-id <\/em><br \/>\n<em><strong>from<\/strong> Section <\/em><br \/>\n<em><strong>where<\/strong> Semester=\u2018Fall\u2019 <strong>and<\/strong> year=2018)<\/em><br \/>\n<em><strong>intersect all<br \/>\n<\/strong>(<strong>select<\/strong> Course-id<\/em><br \/>\n<em><strong>from<\/strong> Section<\/em><br \/>\n<em><strong>where<\/strong> Semester=\u2018Spring\u2019 <strong>and<\/strong> year=2019);<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-810 size-full\" src=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Set-operation-Intersection-all.jpg\" alt=\"Set operation Intersection all\" width=\"371\" height=\"145\" srcset=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Set-operation-Intersection-all.jpg 371w, https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Set-operation-Intersection-all-300x117.jpg 300w\" sizes=\"auto, (max-width: 371px) 100vw, 371px\" \/><br \/>\nAs we have evaluated there is only one course CS-101 that was taught in &#8216;Fall&#8217; 2018 as well as in &#8216;Spring&#8217; 2019. And &#8216;intersect all&#8217; retain &#8216;duplicate&#8217; hence, CS-101 appear twice in the result.<br \/>\n<a name=\"Except\"><\/a><\/p>\n<h3>5. Except Set Operations<\/h3>\n<p>Except operation is a binary operation that outputs all the <strong>tuples<\/strong> from its <strong>first operand<\/strong> that are <strong>not present<\/strong> in the <strong>second operand<\/strong>. Except operation is similar to the <strong>set difference<\/strong>. Except operation eliminates the duplicate tuples from its result.<\/p>\n<p>So, to list all the courses that were taught in &#8216;Spring&#8217; 2019 but the same was <strong>not taught<\/strong> in &#8216;Fall&#8217; 2018 the query for this would be:<\/p>\n<p style=\"text-align: center\"><em>(<strong>select<\/strong> Course-id <\/em><br \/>\n<em><strong>from<\/strong> Section <\/em><br \/>\n<em><strong>where<\/strong> Semester =\u2018Spring\u2019 <strong>and<\/strong> year=2019)<\/em><br \/>\n<em><strong>Except<br \/>\n<\/strong>(<strong>select<\/strong> Course-id<\/em><br \/>\n<em><strong>from<\/strong> Section<\/em><br \/>\n<em><strong>where<\/strong> Semester=\u2018Fall\u2019 <strong>and<\/strong> year=2018);<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-811 size-full\" src=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Except-Set-Operation.jpg\" alt=\"Except Set Operation\" width=\"315\" height=\"261\" srcset=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Except-Set-Operation.jpg 315w, https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Except-Set-Operation-300x249.jpg 300w\" sizes=\"auto, (max-width: 315px) 100vw, 315px\" \/><\/p>\n<p>Observe the result it has all the courses that were taught in Spring 2019, but the same was not taught in Fall 2018. Here, course CS-319 occurs twice as it was taught in two sections in Spring 2019 but except operation eliminates duplicates, it appears just once in the result.<br \/>\n<a name=\"ExceptAll\"><\/a><\/p>\n<h3>6. Except All Set Operation<\/h3>\n<p>Except all operation is a variation of Except operation. The result of Except all operation <strong>retains<\/strong> the <strong>duplicate<\/strong> tuples. So, to list the set of courses that were taught in Spring 2019 but not in Fall 2018 the query would be:<\/p>\n<p style=\"text-align: center\"><em>(<strong>select<\/strong> Course-id <\/em><br \/>\n<em><strong>from<\/strong> Section <\/em><br \/>\n<em><strong>where<\/strong> Semester =\u2018Spring\u2019 <strong>and<\/strong> year=2019)<\/em><br \/>\n<em><strong>Except<br \/>\n<\/strong>(<strong>select<\/strong> Course-id<\/em><br \/>\n<em><strong>from<\/strong> Section<\/em><br \/>\n<em><strong>where<\/strong> Semester=\u2018Fall\u2019 <strong>and<\/strong> year=2018);<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-812 size-full\" src=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Except-all-Set-Operation.jpg\" alt=\"Except all Set Operation\" width=\"352\" height=\"278\" srcset=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Except-all-Set-Operation.jpg 352w, https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Except-all-Set-Operation-300x237.jpg 300w\" sizes=\"auto, (max-width: 352px) 100vw, 352px\" \/><\/p>\n<p>Observe the result above, it has retained the duplicate course CS-319 as it has appeared twice for two sections in Spring 2019.<br \/>\nSo, this was all about Set operations in SQL. We have discussed three set operations union, intersect and except operation. Remember, the set operations are applicable to type compatible relations that have equal number of attributes with the same domain.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Set operations integrate the outcome of two entirely independent SQL queries. There are three set operations in SQL Union, Intersect, Except. These set operations are based on the principles of mathematical set theory. The set operations are applicable to the type compatible relations only, that means relations involved in operation must have an &#8216;equal number [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[4],"tags":[],"class_list":{"0":"post-798","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-dbms","7":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What are Set Operations in SQL? Union,Intersect, Except - Binary Terms<\/title>\n<meta name=\"description\" content=\"Set operations integrate the outcome of two entirely independent SQL queries. There are three set operations in SQL Union, Intersect, Except. These set operations are based on the principles of mathematical set theory.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/binaryterms.com\/set-operations-in-sql.html\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What are Set Operations in SQL? Union,Intersect, Except - Binary Terms\" \/>\n<meta property=\"og:description\" content=\"Set operations integrate the outcome of two entirely independent SQL queries. There are three set operations in SQL Union, Intersect, Except. These set operations are based on the principles of mathematical set theory.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/binaryterms.com\/set-operations-in-sql.html\" \/>\n<meta property=\"og:site_name\" content=\"Binary Terms\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-04T04:55:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-01-18T07:11:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Section-Relation-in-database.jpg\" \/>\n<meta name=\"author\" content=\"Neha T\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Neha T\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/binaryterms.com\/set-operations-in-sql.html#article\",\"isPartOf\":{\"@id\":\"https:\/\/binaryterms.com\/set-operations-in-sql.html\"},\"author\":{\"name\":\"Neha T\",\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe\"},\"headline\":\"Set Operations in SQL\",\"datePublished\":\"2019-12-04T04:55:10+00:00\",\"dateModified\":\"2021-01-18T07:11:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/binaryterms.com\/set-operations-in-sql.html\"},\"wordCount\":1053,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/binaryterms.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/binaryterms.com\/set-operations-in-sql.html#primaryimage\"},\"thumbnailUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Section-Relation-in-database.jpg\",\"articleSection\":[\"DBMS\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/binaryterms.com\/set-operations-in-sql.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/binaryterms.com\/set-operations-in-sql.html\",\"url\":\"https:\/\/binaryterms.com\/set-operations-in-sql.html\",\"name\":\"What are Set Operations in SQL? Union,Intersect, Except - Binary Terms\",\"isPartOf\":{\"@id\":\"https:\/\/binaryterms.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/binaryterms.com\/set-operations-in-sql.html#primaryimage\"},\"image\":{\"@id\":\"https:\/\/binaryterms.com\/set-operations-in-sql.html#primaryimage\"},\"thumbnailUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Section-Relation-in-database.jpg\",\"datePublished\":\"2019-12-04T04:55:10+00:00\",\"dateModified\":\"2021-01-18T07:11:10+00:00\",\"description\":\"Set operations integrate the outcome of two entirely independent SQL queries. There are three set operations in SQL Union, Intersect, Except. These set operations are based on the principles of mathematical set theory.\",\"breadcrumb\":{\"@id\":\"https:\/\/binaryterms.com\/set-operations-in-sql.html#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/binaryterms.com\/set-operations-in-sql.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/binaryterms.com\/set-operations-in-sql.html#primaryimage\",\"url\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Section-Relation-in-database.jpg\",\"contentUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Section-Relation-in-database.jpg\",\"width\":476,\"height\":604,\"caption\":\"Section-Relation in database\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/binaryterms.com\/set-operations-in-sql.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/binaryterms.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Set Operations in SQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/binaryterms.com\/#website\",\"url\":\"https:\/\/binaryterms.com\/\",\"name\":\"Binary Terms\",\"description\":\"The Computer Science &amp; IT Guide\",\"publisher\":{\"@id\":\"https:\/\/binaryterms.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/binaryterms.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/binaryterms.com\/#organization\",\"name\":\"Binary Terms\",\"url\":\"https:\/\/binaryterms.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png\",\"contentUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png\",\"width\":400,\"height\":63,\"caption\":\"Binary Terms\"},\"image\":{\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe\",\"name\":\"Neha T\",\"url\":\"https:\/\/binaryterms.com\/author\/author\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What are Set Operations in SQL? Union,Intersect, Except - Binary Terms","description":"Set operations integrate the outcome of two entirely independent SQL queries. There are three set operations in SQL Union, Intersect, Except. These set operations are based on the principles of mathematical set theory.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/binaryterms.com\/set-operations-in-sql.html","og_locale":"en_GB","og_type":"article","og_title":"What are Set Operations in SQL? Union,Intersect, Except - Binary Terms","og_description":"Set operations integrate the outcome of two entirely independent SQL queries. There are three set operations in SQL Union, Intersect, Except. These set operations are based on the principles of mathematical set theory.","og_url":"https:\/\/binaryterms.com\/set-operations-in-sql.html","og_site_name":"Binary Terms","article_published_time":"2019-12-04T04:55:10+00:00","article_modified_time":"2021-01-18T07:11:10+00:00","og_image":[{"url":"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Section-Relation-in-database.jpg","type":"","width":"","height":""}],"author":"Neha T","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Neha T","Estimated reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/binaryterms.com\/set-operations-in-sql.html#article","isPartOf":{"@id":"https:\/\/binaryterms.com\/set-operations-in-sql.html"},"author":{"name":"Neha T","@id":"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe"},"headline":"Set Operations in SQL","datePublished":"2019-12-04T04:55:10+00:00","dateModified":"2021-01-18T07:11:10+00:00","mainEntityOfPage":{"@id":"https:\/\/binaryterms.com\/set-operations-in-sql.html"},"wordCount":1053,"commentCount":0,"publisher":{"@id":"https:\/\/binaryterms.com\/#organization"},"image":{"@id":"https:\/\/binaryterms.com\/set-operations-in-sql.html#primaryimage"},"thumbnailUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Section-Relation-in-database.jpg","articleSection":["DBMS"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/binaryterms.com\/set-operations-in-sql.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/binaryterms.com\/set-operations-in-sql.html","url":"https:\/\/binaryterms.com\/set-operations-in-sql.html","name":"What are Set Operations in SQL? Union,Intersect, Except - Binary Terms","isPartOf":{"@id":"https:\/\/binaryterms.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/binaryterms.com\/set-operations-in-sql.html#primaryimage"},"image":{"@id":"https:\/\/binaryterms.com\/set-operations-in-sql.html#primaryimage"},"thumbnailUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Section-Relation-in-database.jpg","datePublished":"2019-12-04T04:55:10+00:00","dateModified":"2021-01-18T07:11:10+00:00","description":"Set operations integrate the outcome of two entirely independent SQL queries. There are three set operations in SQL Union, Intersect, Except. These set operations are based on the principles of mathematical set theory.","breadcrumb":{"@id":"https:\/\/binaryterms.com\/set-operations-in-sql.html#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/binaryterms.com\/set-operations-in-sql.html"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/binaryterms.com\/set-operations-in-sql.html#primaryimage","url":"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Section-Relation-in-database.jpg","contentUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2019\/12\/Section-Relation-in-database.jpg","width":476,"height":604,"caption":"Section-Relation in database"},{"@type":"BreadcrumbList","@id":"https:\/\/binaryterms.com\/set-operations-in-sql.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/binaryterms.com\/"},{"@type":"ListItem","position":2,"name":"Set Operations in SQL"}]},{"@type":"WebSite","@id":"https:\/\/binaryterms.com\/#website","url":"https:\/\/binaryterms.com\/","name":"Binary Terms","description":"The Computer Science &amp; IT Guide","publisher":{"@id":"https:\/\/binaryterms.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/binaryterms.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/binaryterms.com\/#organization","name":"Binary Terms","url":"https:\/\/binaryterms.com\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/","url":"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png","contentUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png","width":400,"height":63,"caption":"Binary Terms"},"image":{"@id":"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe","name":"Neha T","url":"https:\/\/binaryterms.com\/author\/author"}]}},"_links":{"self":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts\/798","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/comments?post=798"}],"version-history":[{"count":2,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts\/798\/revisions"}],"predecessor-version":[{"id":2253,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts\/798\/revisions\/2253"}],"wp:attachment":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/media?parent=798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/categories?post=798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/tags?post=798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}