preface

When designing the tables of relational databases, we often need to consider which business fields should be placed in which tables, whether the fields should be split, and how to associate the tables with each other. Are there any rules or principles that guide how we design tables? Three paradigms of database design; The three normal form is mainly to solve the relation between tables, and field redundancy problem

Pay attention to the public account, communicate together, wechat search: sneak forward

The first paradigm

  • Columns are non-divisible, and the goal of the first normal form is to ensure that each column is atomic, that each column is the smallest non-divisible unit of data
  • Height and weight are two attributes that violate the first normal form and cannot be divided into the same column

  • Design that conforms to the first paradigm

The second paradigm

  • First of all, ensure that each column is associated with the primary key and that there are no independent or partial primary key dependencies for non-primary key columns in the table. Usually because there are multiple primary keys, or there are compound primary keys, you need to split the table
  • The existence of composite primary keys (student number, subject), while subject credits depend only on the division primary key – subject, does not conform to the second normal form

  • A correct demonstration of the second paradigm

The third paradigm

  • It satisfies the second normal form, and the columns in the table have no transitive dependence on non-primary key columns, and each column is directly related to the primary key column, not indirectly
  • In the score table, the hobby is dependent on the student, and the student is dependent on the primary key ID, so the transfer dependency should be extracted from the student’s personal information as the table.

  • Conforming to the norms of the Third normal form

Corrections are welcome

Refer to the article

  • Mysql database design three paradigms