Now I am going through the second data center charging system. The overall progress is relatively slow compared with others, but the results are quite fruitful.
Having gone through the first data center charging system, there was almost no feeling of database knowledge at that time, that is to say, I learned a video about SQL and used VB to implement the data center charging system. at that time, the database was hardly called a design, that is, to add anything to the table when you think of it. however, it was troublesome to modify the data type, add a field, or delete a field, and there are many duplicate table contents. that is, data redundancy.
Following the Learning Philosophy of upgrading the class n + 1, we need to learn and improve database-related knowledge in the second IDC charging system. of course, the second database design I will show will certainly have many shortcomings! Strive for continuous improvement.
Before that, Cheng Yun told us about the design of the three paradigm of database. At that time, he looked at a bunch of formulas and concepts, and listened to them in the fog, but he was quite clear about what he said. after listening to the lecture, I made a preliminary summary of the three paradigms. For details, refer to the blog.
Database three paradigm.
Here we will briefly describe the three paradigm
1nf: all fields different from the primary key must depend on the primary key.
2nf: all non-key values must be completely dependent on the primary key, that is, part of the dependency is not allowed. (part of the dependency is that the field is completely dependent on a part that complies with the primary key)
3nf: attributes do not depend on other non-primary attributes, that is, transmission dependencies are eliminated.
Why use the paradigm? My understanding is a kind of standardization of database design, Just Like why do we have laws in this society? It is also a norm for human behavior, making human society more orderly. database standardization makes physical space better organized and used.
Let's take a look at the student information table we made in the charging system for the first time as an example. When we were designing the table, we didn't think so much, that is, we entered the content table according to our own ideas, that is, the following table.
We can see that the content in the student information table we designed previously does not conform to the second paradigm. Generally, For the first paradigm, the table we just made is not fully dependent on the primary key.
After modification, the student information table is divided into two tables:
The table relationships are as follows:
Other tables have been modified accordingly. I have added some relational graphs. This is my own attempt. In terms of database design, there will be some shortcomings, so we need to continue learning and improving. learn more in constant attempts. constantly Improve Yourself In N + 1!