Eliminating Repeating Groups (Normalizing the Database)
Go Up to Normalizing the Database
When a field in a given row contains more than one value for each occurrence of the primary key, then that group of data items is called a repeating group. This is a violation of the first normal form, which does not allow multi-valued attributes.
Refer to the DEPARTMENT
table. For any occurrence of a given primary key, if a column can have more than one value, then this set of values is a repeating group. Therefore, the first row, where DEPT_NO
= “100”, contains a repeating group in the DEPT_LOCATIONS
column.
DEPT_NO
|
DEPARTMENT
|
HEAD_DEPT
|
BUDGET
|
DEPT_LOCATIONS
|
---|---|---|---|---|
100 |
Sales |
000 |
1000000 |
Monterey, Santa Cruz, Salinas |
600 |
Engineering |
120 |
1100000 |
San Francisco |
900 |
Finance |
000 |
400000 |
Monterey |
In the next example, even if you change the attribute to represent only one location, for every occurrence of the primary key “100”, all of the columns contain repeating information except for DEPT_LOCATION
, so this is still a repeating group.
DEPT_NO
|
DEPARTMENT
|
HEAD_DEPT
|
BUDGET
|
DEPT_LOCATION
|
---|---|---|---|---|
100 |
Sales |
000 |
1000000 |
Monterey |
100 |
Sales |
000 |
1000000 |
Santa Cruz |
600 |
Engineering |
120 |
1100000 |
San Francisco |
100 |
Sales |
000 |
1000000 |
Salinas |
To normalize this table, we could eliminate the DEPT_LOCATION
attribute from the DEPARTMENT
table, and create another table called DEPT_LOCATIONS
. We could then create a primary key that is a combination of DEPT_NO
and DEPT_LOCATION
. Now a distinct row exists for each location of the department, and we have eliminated the repeating groups.
DEPT_NO
|
DEPT_LOCATION
|
---|---|
100 |
Monterey |
100 |
Santa Cruz |
600 |
San Francisco |
100 |
Salinas |