Are foreign keys really necessary in a database design?

前端 未结 24 2321
执笔经年
执笔经年 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:42

    As far as I know, foreign keys are used to aid the programmer to manipulate data in the correct way.

    FKs allow the DBA to protect data integrity from the fumbling of users when the programmer fails to do so, and sometimes to protect against the fumbling of programmers.

    Suppose a programmer is actually doing this in the right manner already, then do we really need the concept of foreign keys?

    Programmers are mortal and fallible. FKs are declarative which makes them harder to screw up.

    Are there any other uses for foreign keys? Am I missing something here?

    Although this is not why they were created, FKs provide strong reliable hinting to diagramming tools and to query builders. This is passed on to end users, who desperately need strong reliable hints.

提交回复
热议问题