Normalisation
Why normalise?
Imagine storing every club booking in one table, with the coach repeated on every row: each booking of the Chess club would carry "Mr Ng" again and again.
That repetition causes problems. If Mr Ng leaves, you must update many rows; miss one and the data becomes inconsistent. Normalisation organises tables to remove this kind of redundancy.
왜 normalise?
모든 클럽 예약을 one 테이블에 저장하여 코치를 모든 행에 반복 Stored Imagine: 체스 클럽의 각 예약마다 "Ng 씨"가 반복될 것입니다.
그런 반복은 문제를 일으킵니다. Ng씨가 퇴사하면 many 행을 업데이트해야 하며, 하나를 놓치면 데이터가 일관성을 잃습니다. Normalisation은 이러한 중복을 제거하도록 테이블을 조직화합니다.
The normal forms
You normalise in steps:
- 1NF — every cell holds a single value (no lists or repeating groups), and the table has a primary key.
- 2NF — already 1NF, and no non-key column depends on only part of a composite key.
- 3NF — already 2NF, and no non-key column depends on another non-key column (no transitive dependency).
In the one-table version, coach depends on the club, not on the booking — a transitive dependency, so it is not in 3NF.
Normal forms
단계별로 normalise합니다:
- 1NF — 모든 cell이 단일 값을 가지며(리스트나 repeating groups 없음), 테이블에는 primary key가 있습니다.
- 2NF — 이미 1NF이며, 비키 열이 복합 키의 part에만 의존하지 않습니다.
- 3NF — 이미 2NF이며, 비키 열이 another non-key column에 의존하지 않습니다(transitive dependency 없음).
단일 테이블 버전에서, coach은 club에 의존하며 예약에는 의존하지 않습니다 — transitive dependency이므로 not in 3NF입니다.
The normalised design
We split the data into two tables (the ones loaded here):
club(club_id, name, coach)— each club and its coach, stored once.booking(booking_id, student, club_id)— each booking, linked by the foreign keyclub_id.
Now a coach is stored once. A JOIN puts the information back together whenever you need it — write that join below.
Normalised design
데이터를 두 테이블로 분할했습니다(여기에 로드된 것):
club(club_id, name, coach)— 각 클럽과 코치를 once로 저장합니다.booking(booking_id, student, club_id)— 각 예약을 외래 키club_id로 연결합니다.
이제 코치는 한 번만 저장됩니다. JOIN는 필요할 때마다 정보를 다시 조립합니다 — 아래에 그 연결을 적으세요.
Common mistakes
- Split repeating groups into their own table instead of many similar columns.
- Each table should describe one kind of thing.
흔한 실수
- 반복되는 그룹을 여러 유사한 열 대신 자체 테이블로 분리하세요.
- 각 테이블은 하나의 유형을 설명해야 합니다.
Reassemble the data: list each booking's student next to their club's coach, by joining booking to club on club_id, ordered by booking.booking_id.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.
The split tables still answer questions together. Count how many bookings each club has: join booking to club, show club.name and COUNT(*) AS bookings, group by the club, and order by club.name.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.