How can you model a zero, one or many type relationship without breaking first normal form? That is, not storing any NULL values.
Separate relation table? Is it "worth" adding a table, or is this over-normalization?
Here's an example that corresponds to my real world case:
Say we have a college, with some free courses and some free dorm rooms. Some of the courses and dorm rooms do come with a fee though. And many of the courses and room does have the same fee (amount), although they are different courses/rooms.
So we'll have:
tblCourse
Id
Name
tblDormRoom
Id
Address
tblFee
Id
Amount
In order to model this my take was to add two tables to hold the optional one-to-many relationship.
tblCourseToFee
CourseId
FeeId
tblDormRoomToFee
DormRoomId
FeeId
This way I can avoid storing any null values, and also avoid duplicate storage of the Fee's that are shared between DormRoom and Course.
And the quick n dirtier version considered, that doesn't strictly adhere to 1NF:
tblFee
Id
CourseId (nullable)
DormRoomId (nullable)
Amount
This only uses one table instead of three, but introduces null values..