In the design of dynamic website, the importance of database design is self-evident. If poorly designed, the query is very laborious, the performance of the program will also be affected. No
When you use MySQL or Oracle database, you can make your PHP code more readable and extensible by using a formalized table design to
will also improve the performance of your application.
In short, regularization is the elimination of redundant and uncoordinated dependencies when designing tables. In this article, I'm going to go through five progressive processes to tell
The regularization techniques you should be aware of in your design. Thus establishing a viable and
High-efficiency database. This article also gives a detailed analysis of the types of relationships that can be leveraged.
This assumes that we want to create a table of user information that stores the user's name, company, company address, and some personal favorites or URLs. In the Open
At the beginning, you might define a table structure like this:
0 State Form
Users
Name company Company_address URL1 URL2
Joe ABC 1 Work Lane abc.com xyz.com
Jill XYZ 1 Job Street abc.com xyz.com
Since no normalization has been done, we refer to this form of table as a 0-state form. Note the URL1 and URL2 fields---if we
Need a third URL in your app? So you're going to add a column to the table, which is obviously not a good idea. If you're going to create an extensibility-rich
System, you should consider using the first formalized form and apply it to the table.
First Level regularization form
1. Eliminate duplicate groups in each table
2. Create a separate table for each set of related data
3. Use a primary key to identify each set of related data
The above table clearly violates the first rule above, then what does the primary key of the third article mean? Very simply, it simply adds a
A unique, auto-incremented integer value. With this value, you can distinguish between two records of the same name. By applying the first-level normalization form, we
The following table was obtained:
Users
UserId name company company_address URL
1 Joe ABC 1 work Lane abc.com
1 Joe ABC 1 work Lane xyz.com
2 Jill XYZ 1 Job Street abc.com
2 Jill XYZ 1 Job Street xyz.com
Now our table can be said to be in the form of the first level of normalization, it has resolved the URL field restrictions, but this processing has brought
A new problem. Every time we insert a record in the user table, we have to repeat all the company and user data. This not only makes the database more
It's old, and it's easy to make mistakes. Therefore, the second level of normalization is also to be processed.
http://www.bkjia.com/PHPjc/531982.html www.bkjia.com true http://www.bkjia.com/PHPjc/531982.html techarticle in the design of dynamic website, the importance of database design is self-evident. If poorly designed, the query is very laborious, the performance of the program will also be affected. Whether you are using M ...