6

My question is whether the inclusion of a field that contains an array of UUIDs breaks the Normal Form, in a table that before the inclusion of the array was in NF?

Original table:

CREATE TABLE Floor
(
    "Floor-ID" uuid NOT NULL,
    "Floor-Floor" smallint NOT NULL,
    "Floor-Desc" varchar(300),
    CONSTRAINT "Floor-PK" PRIMARY KEY ("Floor-ID")
);

New table, including UUID array:

CREATE TABLE Floor
(
    "Floor-ID" uuid NOT NULL,
    "Floor-Floor" smallint NOT NULL,
    "Floor-Desc" varchar(300),
    "Floor-Room-IDs" uuid[] NOT NULL,
    CONSTRAINT "Floor-PK" PRIMARY KEY ("Floor-ID")
);


Does the inclusion of uuid[] break Normal Form?
(The same UUID could theoretically exist in multiple UUID arrays on multiple rows.)

Bam
  • 478
  • 6
  • 19

1 Answers1

6

In short - yes.

1NF is defined as:

relation is in first normal form if the domain of each attribute contains only atomic values, and the value of each attribute contains only a single value from that domain.

In other words, none of the fields should have elements which are themselves sets (or arrays, for that matter).

Mureinik
  • 297,002
  • 52
  • 306
  • 350
  • 1
    If an array of UUIDs is considered a “single value” in the domain, it’s perfectly fine, though. It depends on the context. –  Dec 21 '13 at 15:33
  • 5
    If you can treat any of its values as a singular value, it breaks 1NF. If you can't, then holding it in a array is indeed inconsequential. – Mureinik Dec 21 '13 at 15:37