I have known the SQL Server 2005/2008 EXCEPT and INTERSECT keywords for some time, but have never found a good reason to use it INTERSECTover the old old UNION.
INTERSECT
UNION
Can someone explain when or why you would use INTERSECTinstead UNION?
They do different things.
From MSDN:
EXCEPT returns any single values ββfrom the left query that are also not found in the correct query.
INTERSECT , INTERSECT.
UNION , , .
INTERSECT ,
UNION , .
EXCEPT , , .
EXCEPT
INTERSECT EXCEPT , , IN/NOT IN.
IN
NOT IN
, SQL Server IN .
SQL Server
INTERSECT EXCEPT, JOIN IN, NULL . :
JOIN
NULL
SELECT NULL INTERSECT SELECT NULL
, :
SELECT NULL WHERE NULL IN ( SELECT NULL )
.
INTERSECT INNER JOINS, , .
- . , : "", , "", . , EXCEPT. (: LEFT JOIN.. WHERE left_site IS NULL)
Source: https://habr.com/ru/post/1730191/More articles:Noobie WPF namespace and converter problem - namespacesA universal utility or library for compiling / decompiling binary data files? - compiler-constructionWhere can I find a good 2D code library for Java ME? - javaConversion error while converting nvarchar value to int - sql-serverhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1730190/git-push-to-assembla-repository-from-multiple-machines&usg=ALkJrhjt4dD1oPJqJ9Xcj1hsc5DsaZ0UQQPython: simulate search algorithms in network models - pythonC # GUI macro libraries or generic approaches? - macrosHibernation: automatic versioning of Nullable Column - javaConvert PDF to PDF / A-1 - pdfHow to fix fatal error C1113: #using failed to execute 'Mylib.lib' - dllAll Articles