Reputation: 1590
In a database that have Orders, Customers tables, i need the relation between these two tables to be zero or one to many relationship, simply because in my application, an order can exist without being assigned to a customer.
One first idea that comes to my mind is to make the foreign key nullable, this way when creating an order the foreign key can be null, but i don't know how to do so. I'm working on a model so i can render it to my 'teacher', so i need to know how to do it using the EER diagram.
thanks in advance.
Upvotes: 8
Views: 35076
Reputation: 448
Simply do it this way
Upvotes: 7
Reputation: 161
Mandatory option in "Foreign Key" tab in "Relationship" tab appears to be the way to control optionality.
Upvotes: 16
Reputation: 2337
Create your 1:n relationship as normal. Then double click the table to bring up the details. On your new FK field, uncheck the "NN" column. Now your FK can be NULL.
Upvotes: 7