Oracle
 sql >> Base de données >  >> RDS >> Oracle

SELECT à l'aide de la clause UNION

Vous devez utiliser INTERSECT et MINUS (pour Oracle):

-- 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')

Depuis UNION ajoute sous-requêtes tant que EXCEPT /MINUS soustrait eux