...

/

Multiple Values per Column

Multiple Values per Column

Learn how having multiple values per column affects a database.

The multivalued field in a database schema

A table (relation) is in 1NF if:

  • There are no duplicated rows in the table
  • Each cell is single-valued (no repeating groups or arrays)
  • Entries in a column (field) are similar

An anti-pattern that fails to comply with those rules means having a multivalued field in a database schema:

create table tweet
 (
   id      bigint primary key,
   date    timestamptz,
   message text,
   tags    text
 );

Data would then be added with a semicolon separator, for instance, or maybe a pipe | char, or in some cases with a fancy Unicode separator char such as §, , or ¦. Here, we find a classic semicolon:

         id         │ date │ message │          tags
...