- Both methods are commonly used to derive the unique values for dimension keys of portlets.
- EXISTS are preferable to DISTINCT.
- DISTINCT produces the entire result set (including duplicates),sorts, and then filters out duplicates
SELECT DISTINCT SRMR.FULL_NAME FROM SRM_RESOURCES SRMR JOIN PRTEAM TM ON SRMR.ID=TM.PRRESOURCEID
Exists proceeds with fetching rows immediately after the sub-query condition has been satisfied the first time
SELECT SRMR.FULL_NAME FROM SRM_RESOURCES SRMR
WHERE EXISTS (SELECT 1 FROM PRTEAM TM WHERE SRMR.ID=TM.PRRESOURCEID)