상관쿼리
-
subquery _ 상관쿼리( correlated subquery )SQL/sql 문법(mysql, mariaDB) 2024. 5. 8. 18:21
▤ 목차" data-ke-type="html">HTML 삽입미리보기할 수 없는 소스지난번 subquery에대해 정리를 했다.서브쿼리란 쿼리 안에 다른 쿼리가 들어간 것을 의미한다.밖의 쿼리는 outer 쿼리, 메인쿼리라고 하며 안쪽 쿼리는 inner 쿼리, 서브쿼리라고 한다. 지금까지는 메인 쿼리가 실행되다가 서브쿼리의 반환값을 가져와 쿼리가 진행되었다.✔ 상관(연관) 관계가 있는 서브쿼리( correlated subquery )내부 쿼리가 외부쿼리에서 얻은 정보에 의해 실행되는 쿼리가 있다.이와 같이 상관관계가 있는 서브쿼리가 있다.상관쿼리는 서브쿼리 단독으로 실행할 수 없다.상관관계가 있는 서브쿼리 또한 SELECT, WHERE, FROM문에 사용된다. ⌨ 실행되는..