반응형

--exists 존재한다면 진행하고 없다면 스킵한다
--not exists exists 와 반대

 

select *
from players
where exists (select playerID from battingpost where battingpost.playerID = players.playerID );

(select playerID from battingpost where battingpost.playerID = players.playerID )

서브 쿼리를 보면 battingpost.playerID = players.playerID 두 조건이 같은것이 존재 할때만(exists) players 의 정보를 보여주며 그렇지 않으면 스킵한다


결과

반응형

'서버(Server) > DB' 카테고리의 다른 글

DB : 인덱스(Index)  (0) 2023.02.13
DB : DB(스키마) 만들기, 테이블 만들기와 Primary Key 의 성능  (0) 2023.02.12
DB : subquery  (0) 2023.02.04
DB : Insert into , Delete, Update  (0) 2023.02.03
DB : group by  (0) 2023.02.02

+ Recent posts