2

Does having a composite/compound key (using multiple columns/attributes) to form the primary key break first normal form? (I am assuming that this is handled by the DBMS, and so the attribute containing composite key does not exist in the table/relation itself, and so this still complies with the first normal form, but is this correct?) thanks.

2 Answers 2

3

No, this is quite normal (pun intended). The criteria is

First Normal Form:

Tables are said to be in first normal form when:

  • The table has a primary key.
  • No single attribute (column) has multiple values.
  • The non-key attributes (columns) depend on the primary key.

None of these requirements for 1NF is violated by the design you propose.

For instance a Junction Table created to normalize a many-to-many relationship will always have a composite Primary Key, with each component being also a Foreign Key into one of the joined tables.

2
  • You said "The non-key attributes (columns) depend on the primary key". Does it mean that if a non-key attribute transitively depends on the primary key, then the table is in First Normal Form? Sep 30, 2020 at 7:46
  • I don't know, from where you got this definition. But, 1NF talks that every attributes must have atomic value. There is no concept of Primary Key in its definition. Also, during design phase i.e. Relational design phase we don't use the term Primary Key in its definition. We use Candidate key. Can you please provide the proper link of the definition you have stated? Inscribed link doesn't work.
    – Ubi.B
    Oct 15, 2020 at 3:57
0

A table in First Normal Form can have a composite key that have many columns to form a primary key:

When a table in the first normal form:

  1. has a primary key.
  2. No attribute/column has multiple values.
  3. The non-key attributes/columns depend on the primary key.
  4. The non-key has no repeating groups in attributes/Columns

For instance, the following two examples are not in the first normal form:

One student table with a student ID and class:

1st example: class column has many values.
2nd example: classes are repeating groups.

a.  Student_id, (class_1, class_2,class_3).  
b.  Student_id, class_1, class_2, class_3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.