Skip to Content
SQL 시작하기
book

SQL 시작하기

by Thomas Nield
May 2025
Beginner to intermediate
134 pages
1h 46m
Korean
O'Reilly Media, Inc.
Content preview from SQL 시작하기

8장. JOIN

이 작품은 AI를 사용하여 번역되었습니다. 여러분의 피드백과 의견을 환영합니다: translation-feedback@oreilly.com

테이블 연결하기

조인은 SQL의 기능을 정의하며 다른 데이터 기술과 차별화됩니다. 지금까지 다룬 내용에 어느 정도 익숙해졌는지 확인하고 시간을 들여 연습하고 복습한 후 계속 진행하세요.

이 책의 서두에서 관계형 데이터베이스에 대해 논의하던 때로 돌아가 보겠습니다. "정규화된" 데이터베이스에는 다른 테이블을 가리키는 필드가 있는 테이블이 있는 경우가 많다는 것을 기억하시나요? 예를 들어 CUSTOMER_ID 필드가 있는 CUSTOMER_ORDER 테이블을 생각해 보겠습니다(그림 8-1).

The CUSTOMER_ORDER table has a CUSTOMER_ID field
그림 8-1. CUSTOMER_ORDER 테이블에는 CUSTOMER_ID 필드가 있습니다.

CUSTOMER_ID 필드는 CUSTOMER 테이블에서 조회할 키를 제공합니다. 이 사실을 알면 CUSTOMER 테이블에도 CUSTOMER_ID 필드가 있는 것은 놀라운 일이 아닙니다(그림 8-2).

The CUSTOMER table has a CUSTOMER_ID key field that can be used to get customer information
그림 8-2. CUSTOMER 테이블에는 고객 정보를 가져오는 데 사용할 수 있는 CUSTOMER_ID 키 필드가 있습니다.

이 테이블에서 주문에 대한 고객 정보를 검색할 수 있는데, 이는 Excel의 VLOOKUP과 매우 유사합니다.

이것은 CUSTOMER_ORDER 테이블과 CUSTOMER 테이블 사이의 관계에 대한 예제 입니다. CUSTOMERCUSTOMER_ORDER부모라고 할 수 있습니다. CUSTOMER_ORDERCUSTOMER 에 정보를 의존하므로 CUSTOMER자식입니다. 반대로 CUSTOMERCUSTOMER_ORDER 에 정보를 의존하지 않으므로 의 자식이 될 수 없습니다. 그림 8-3의 다이어그램은 이 관계를 보여 줍니다. 화살표는 CUSTOMERCUSTOMER_ID 를 통해 CUSTOMER_ORDER 에 고객 정보를 제공함을 나타냅니다.

CUSTOMER is the parent to CUSTOMER_ORDER, because CUSTOMER_ORDER depends on it for CUSTOMER information
그림 8-3. CUSTOMER는 CUSTOMER_ORDER의 상위 항목으로, CUSTOMER_ORDER는 CUSTOMER 정보에 의존하기 때문입니다.

관계에서 고려해야 할 또 다른 측면은 자식의 레코드가 부모의 단일 레코드에 얼마나 연결될 수 있는지입니다. CUSTOMERCUSTOMER_ORDER 테이블을 보면 단일 고객 레코드가 여러 주문과 연결될 수 있는 일대다 관계임을 알 수 있습니다. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Oracle Database 11g Release 2 Performance Tuning Tips & Techniques

Oracle Database 11g Release 2 Performance Tuning Tips & Techniques

Richard Niemiec

Publisher Resources

ISBN: 9798341656307