简体   繁体   中英

Best Way to Handle Zero to One (Optional) Foreign Key Relationships in MySql

Not sure if this is possible... however I have a table called "LineItems" with a column called "PackageId" -> PackageId IS optional, however i'd still like to somehow setup a foreign key relationship to its relating table Packages - is this possible? If so how might I go about doing it

Also, I will be using the ADO.net Entity Framework Model v4 in conjunction with MySql. i would like to apply this constraint via MySQL (if possible) and have it carry into the Entity Framework model code

thanks!

Loren

我为自己的无知表示歉意,但是我刚刚了解到,通过将列设置为允许null出现,可以让我仍然保留前键关系

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM