I am using the code first approach and want to create a table called Classes. This table will hold the following information:
- Name (Math 1)
- Code (MatA)
- Subject (Mathmatics)
- Description (Math is fun)
- BeginTime (DateTime)
- EndTime (DateTime)
- BeginDate (DateTime)
- EndDate (DateTime)
In addition to the above, I would like to assign the days a class will happen:
- Name (Math 1)
- Code (MatA)
- Subject (Mathmatics)
- Description (Math is fun)
- BeginTime (DateTime)
- EndTime (DateTime)
- BeginDate (DateTime)
- EndDate (DateTime)
- Monday (bool)
- Tuesday (bool)
- etc.
I do not want to do the above, it just seems inefficient, especially when I need to call a class depending on the current date (ie. Get all classes that appear on Monday).
So, what kind of table structure should I have?
Thanks
You should create 2 tables, 1 for
Classesand 1 forClassSchedules. Join your tables with aClassIdcolumn.BTW, you shouldn’t need 2 columns for
BeginTimeandBeginDate, those should be stored in the same column — same goes forEndTimeandEndDate.