What is the difference between INNER JOIN and INTERSECT?

5

What is the difference between INNER JOIN and INTERSECT? Can anyone exemplify it too?

    
asked by anonymous 01.12.2017 / 14:41

1 answer

1

INTERSECT and EXCEPT operations are performed based on the implicit conversion of the result between two queries.

INNER JOIN operations link two tables or queries through one or more fields.

Syntax

 <query_specification> | ( <query_expression> )    
 EXCEPT | INTERSECT 
 <query_specification> | ( <query_expression> )   

EXAMPLE

-- Uses AdventureWorks  

SELECT ProductID   
FROM Production.Product  
INTERSECT  
SELECT ProductID   
FROM Production.WorkOrder ;  
--Resultado: 238 linhas (produtos que tem WorkOrder)  

Following is the Microsoft documentation reference. EXCEPT and INTERSECT

    
01.12.2017 / 14:51