Is it bad to use redundant relationships?

前端 未结 7 1021
小鲜肉
小鲜肉 2021-01-12 08:20

Suppose I have the following tables in my database:

Now all my queries depend on Company table. Is it a bad practice to give every other table a (redundant

7条回答
  •  迷失自我
    2021-01-12 09:00

    It is bad practice because your redundant data has to be updated independently and therefore redundantly. A process that is fraught with potential for error. (Even automatic cascading has to be assigned and maintained separately)

    By introducing this relation you effectively denormalize your database. Denormalization is sometimes necessary for the sake of performance but from your question it sounds like you're just simplifying your SQL.

    Use other mechanisms to abstract the complexity of your database: Views, Stored Procs, UDFs

提交回复
热议问题