How important are constraints like NOT NULL and FOREIGN KEY if I'll always control my database input with PHP?

后端 未结 15 2147
我在风中等你
我在风中等你 2021-02-04 01:14

I am trying to create a column in a table that\'s a foreign key, but in MySQL that\'s more difficult than it should be. It would require me to go back and make certain changes

15条回答
  •  你的背包
    2021-02-04 01:49

    Use the database for structural data integrity, and use the BR layer for the rest. And catch errors as early as possible. They work together.

    With luck, when your code as matured, you won't experience databse RI errors; and you can proudly announce yourself to be the first.

提交回复
热议问题