First, the database design paradigm and its significance and shortcomings
The design paradigm of database is the specification that database design needs to meet, the normalization of database is the way to optimize the structure of table and how to organize the data into the table, so that the data is clearer and more concise. In practice, it is common to divide a database into two or more tables and define relationships between tables for data isolation, adding, deleting, and modifying a field only in one table, and then passing through the defined relationships to the remaining tables in the database (and the meaning of layered thinking is very much the same). This allows us to eliminate many of the opportunities for error or junk data and to reduce the amount of work necessary to update the information.
At present, there are six main paradigms: the first paradigm, the second paradigm, the third paradigm, the BC Paradigm, the fourth normal form and the fifth paradigm. Meet the minimum requirements called the first normal form, referred to as 1NF. On the basis of the first paradigm to further meet some requirements for the second paradigm, referred to as 2NF. The rest and so forth
Things tend to be multi-faceted, and the design paradigm also brings some trouble: it's difficult to operate because you need to contact multiple tables to get the data you need, and the higher the paradigm, the worse it will be. So the use of how high the paradigm needs to weigh the pros and cons, generally in the project, the use of the third paradigm is sufficient, good performance and easy to manage data.
Second, let us give an example of the three paradigms of database design
Description: Examples of "school computer room charge system" of the "Student Information table", "students up and down the record table" part of the field
1, the first paradigm 1NF
Definition: A field in a database table is a single attribute and cannot be divided.
Simply put, each attribute is an atomic term, indivisible.
1NF is the minimum condition that a relational pattern should have, and if the database design does not meet the first paradigm, it is not called a relational database. That is to say, as long as the relational database, it must satisfy the first normal form.
Let's start with a list of non-conforming 1NF 1-1
Cardno |
Studentno |
Studentname |
Sex |
Department |
Cardcash |
Userid |
UserLevel |
Time |
001 |
021101 |
Xiao ming |
Man |
School of Education, Department of psychology, Class 1 |
100 |
Operator |
Operator |
2011/10/03,09:00 |
This table does not conform to 1NF because the department and Time fields can be re-divided, so you should change to table 1-2:
Cardno |
Studentno |
Studentname |
Sex |
Academy |
Major |
Class |
Cardcash |
UserID |
UserLevel |
Date |
Time |
001 |
021101 |