Database design skills (1)

xiaoxiao2021-03-06  64

Database Design Skills (1) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ allsky important in the design of a dynamic website, database design: ------------------------------------ author Sexualism is self-evident. If the design is improper, it is very difficult to query, and the performance of the program will also be affected. Whether you are using a MySQL or Oracle database, you can make your PHP code more readable and easier to expand by performing normalized table design, which will also improve the performance of the application. Simply put, normalization is to eliminate redundancy and uncoordinated dependence when designing. In this article, I will tell you the formalization skills you should understand in the design through five progressive processes. Thereby establish a feasible and highly high-efficiency database. This article also analyzes the type of relationship that can be utilized. Here, we have to create a table of user information, where the user's name, company address, and some personal favorites or URLs. At the beginning, you may define a table structure: zero state form name company company company_address url1 url2 joe abc 1 Work lane abc.com xyz.com jill xyz 1 job street abc.com xyz.com Due to no regular Treatment, we will refer to the form of a form of a zero-state form. Pay attention to the URL1 and URL2 fields --- If we need the third URL in the app? This way you have to add more columns in the form, it is obvious, this is not a good way. If you want to create an extensibility system, you should consider using the first normalized form and apply it to the table. The first level of normalization 1. Eliminate the duplicate group in each table 2. Create a separate table for each set 3. Use a primary key to identify the table of each associated data to obviously violate the first The provisions of the article, what does the primary key of the third article? Very simple, it is just adding a unique and automatic increase in each record. With this value, you can separate the two names of the same name. By applying the first level of normalization, we get the following table: 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 form can be said in the form of a first-level normalization. It has solved the limitations of the URL field, but this process has brought a new problem. Every time you insert a record in the USER table, we must repeat all companies and user data. This not only makes the database than before, and it is easy to make mistakes. Therefore, it is also necessary to process the second level.

to be continued...........

转载请注明原文地址:https://www.9cbs.com/read-119884.html

New Post(0)