Tip! 참고 사이트
생활코딩: JOIN 연습장
# 예시 코드
SELECT *
FROM topic
LEFT JOIN author ON topic.author_id = author.aid;
SELECT *
FROM topic
LEFT JOIN author ON topic.author_id = author.aid
LEFT JOIN profile ON author.profile_id = profile.pid;
SELECT tid, topic.title, author_id, name, profile.title AS job_title
FROM topic LEFT JOIN author ON topic.author_id = author.aid
LEFT JOIN profile ON author.profile_id = profile.pid;
SELECT tid, topic.title, author_id, name, profile.title AS job_title
FROM topic
LEFT JOIN author ON topic.author_id = author.aid
LEFT JOIN profile ON author.profile_id = profile.pid
WHERE aid = 1;
# 예시 코드
SELECT *
FROM topic
INNER JOIN author ON topic.author_id = author.aid;
SELECT *
FROM topic
INNER JOIN author ON topic.author_id = author.id
INNER JOIN profile ON profile.pid = author.profile_id;
# 예시 코드
SELECT *
FROM topic
FULL OUTER JOIN author ON topic.author_id = author.id;
# 예시 코드
SELECT *
FROM topic
LEFT JOIN author ON topic.author_id = author.aid
WHERE author.aid is NULL;
Tip! 정리
관계형 데이터베이스 다운 개념의 구조
ERD의 구성 요소
식별자 지정
Tip! 추가 수업
생활코딩: 정규화
find slow query