sql >> Base de Datos >  >> RDS >> Oracle

SELECCIONAR utilizando la cláusula UNION

Deberías usar INTERSECT y MINUS (para oráculo):

-- At least at Boston or at Dallas 
(SELECT DNAME 
   FROM DEPARTMENT 
  WHERE CITY = 'DALLAS'

UNION

 SELECT DNAME 
   FROM DEPARTMENT 
  WHERE CITY = 'BOSTON')

MINUS

-- At Boston and at Dallas
(SELECT DNAME 
   FROM DEPARTMENT 
  WHERE CITY = 'DALLAS'

INTERSECT

 SELECT DNAME 
   FROM DEPARTMENT 
  WHERE CITY = 'BOSTON')

Desde UNION agrega subconsultas mientras EXCEPT /MINUS resta ellos