Do you absolutely need foreign keys in a database?

后端 未结 11 1574
孤城傲影
孤城傲影 2021-02-12 20:48

I was wondering how useful foreign keys really are in a database. Essentially, if the developers know what keys the different tables depend on, they can write the queries just

11条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-12 21:21

    I think that assuming that programmers will always preserve data integrity is a risky assumption.

    There's no reason why you wouldn't create foreign keys, and being able to guarantee integrity instead of just hoping for integrity is reason enough.

提交回复
热议问题