database design - How to model optional one-to-many relationship in 1NF -
How can you first model a zero, one or several types without breaking the normal form? That is that no false value is stored.
Different relation table? It is adding a "worth" table, or this is very common
Here is an example that matches my real world case:
We have some free There is a college, say curriculum and some free hostel rooms come with some courses and dormitory rooms a fee. And many more rooms of the course have the same fee (zodiac), although they will be different courses / rooms
then we will.
tblCourse serial name tblDormRoom id address tblFee id number
to take this one to my model, to have optional one-to-many relationship The tables were used to connect.
tblCourseToFee CourseId FeeId tblDormRoomToFee DormRoomId FeeId
In this way I can avoid any zero value storage, and also to avoid duplicate storage Charges are shared between that dormroom and course.
And the Quick N Dirtyire version is considered, which does not strictly adhere to 1 NF:
TBLI ID Course ID (empty) DormRoomId (nullable) amount
This only uses a table instead of three, but presents zero values.
This is an interesting question - first can be a good example of one-to-many relationship in general (I think some of the content here Ld like to t but it is friendly to stackoverflow format) is not.
The basic idea is that you can define two tables and be used as the identifier of the identifier of the main table, with the understanding that the related table may be a related duplicate identifier.
The point of curiosity are you working on some kind of data mining project? I would be interested in learning more about how this would apply.
Comments
Post a Comment