Any example of a necessary nullable foreign key?

后端 未结 8 1795
感情败类
感情败类 2020-12-03 01:42
Customers
 customer_id

Orders
 order_id
 customer_id fk

If I have two tables and define a foreign key on customer_id in the Orders table, by allow

8条回答
  •  盖世英雄少女心
    2020-12-03 02:16

    Imagine a table that holds the TODOs of a team. If a TODO is not yet assigned to a member of the team, its user_id is NULL. If it is not NULL it is a foreign key to the users table.

提交回复
热议问题