When designing a database error prone

Development tools and key technologies: Visual Studio
Author: Xiaoguang Bin
wrote Time: May 26, 2019

At the beginning of a new project, we often need to start implementing a series of preparations inside the function, this series of preparatory course including the most important database, so we do before the project will be to design a database, it can be said the success or failure of all functions of the database is designed correctly, if the database design is wrong, it is impossible to achieve a natural function drops, then I say what I have encountered any problems in the design of the database
Here Insert Picture DescriptionHere Insert Picture Description
first what the problem is, that is, even when the table, we found that even wrong, then we have to delete the foreign key connection in the form, but this time, we ignore that we have removed the foreign key, foreign key, but this connection are still in, this means that we have not delete the foreign key clean, because its line still attached, this is it, when generating a table of the database, and can not generate an error occurs, when we look back to when it is difficult to find there are still such a connection, even when we are wrong line, you need to first cut the connection, and then in the foreign key table That the column removed, so delete clean.
Here Insert Picture Description
The second mistake is, Table A is connected to B table, Table B, Table C is connected, want to get to the data in Table A Table C, then A table even the B table, Table B and C even the table, A table can table B obtained by the data of table C, and even some B a, B C and even, and even C a, above, which is equivalent to the repeat connection, so that both time consuming and resource consuming, as long as the sub-table is connected other tables, while the parent table want to get data from other tables, you can get through the child table, no need to repeat the connection, this will generate an error when a database table, but sometimes not being given, no error, so that when you when implementing functions, you will find that the captured data is repeated, and this time you still need to come back to the database, so this is the first is wrong.
Here Insert Picture Description
The third mistake, the table can not be interconnected, if interconnection table, even if no error when generating database table, but when dealing with the data you will find an error, this time if the need for such connections, we can create a middle table to connect them, the crown by an intermediate connecting them, so that this situation does not occur given connected to each other a.

Guess you like

Origin blog.csdn.net/qq_44505797/article/details/90632164