Are foreign keys really necessary in a database design?

前端 未结 24 2318
执笔经年
执笔经年 2020-11-28 18:08

As far as I know, foreign keys (FK) are used to aid the programmer to manipulate data in the correct way. Suppose a programmer is actually doing this in the right manner alr

24条回答
  •  自闭症患者
    2020-11-28 18:24

    Suppose a programmer is actually doing this in the right manner already

    Making such a supposition seems to me to be an extremely bad idea; in general software is phenomenally buggy.

    And that's the point, really. Developers can't get things right, so ensuring the database can't be filled with bad data is a Good Thing.

    Although in an ideal world, natural joins would use relationships (i.e. FK constraints) rather than matching column names. This would make FKs even more useful.

提交回复
热议问题