Estos operadores se corresponden con los modelos matemáticos de unión o intersección de conjuntos.
Ejemplos
USE AdventureWorks2012; GO SELECT ProductID FROM Production.Product ; --Result: 504 Rows
USE AdventureWorks2012; GO SELECT ProductID FROM Production.Product INTERSECT SELECT ProductID FROM Production.WorkOrder ; --Result: 238 Rows (products that have work orders)
USE AdventureWorks2012; GO SELECT ProductID FROM Production.Product EXCEPT SELECT ProductID FROM Production.WorkOrder ; --Result: 266 Rows (products without work orders)
USE AdventureWorks2012; GO SELECT ProductID FROM Production.WorkOrder EXCEPT SELECT ProductID FROM Production.Product ; --Result: 0 Rows (work orders without products)
Fuente: http://msdn.microsoft.com/es-es/library/ms188055.aspx
No hay comentarios:
Publicar un comentario