java - When dealing with data relationships, what are the advantages and disadvantages of using database table foreign keys versus in-code maintenance?
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-17 10:08:48
0
2
566

Recently I was designing a library table for an enterprise application project, and I encountered some data association problems. I was undecided whether it would be better to maintain within the code or make external associations. I am seeking the opinions of experts.

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(2)
巴扎黑

Let me tell you my personal opinion.
Normally, it is recommended to use database foreign keys. This has relatively complete constraints. Moreover, most applications (80%) of most companies have not yet reached the level of database segmentation. So why not just rely on the integrity of the database? ?

Not using foreign keys is usually too large, so the number should be more than a million. Need to be segmented. Only manually use the program maintenance. . .

刘奇

The demand is stable - use foreign keys
The demand changes frequently - don’t use it

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template