2 Replies Latest reply on Oct 11, 2012 3:30 PM by philmodjunk

    How many tables to store loosely related categories?

    wladdy

      Title

      How many tables to store loosely related categories?

      Post

            

           ‘Cardio’, ‘Classes’ and ‘Workouts’ refer to three types of training sessions.
           They all have a ‘start time’, a ‘length’ and a ‘location’.

           However, they also have very different attributes.
           For instance, ‘Average BPM’, ‘machine’ and ‘pace’ are specific to ‘Cardio’, while ‘Instructor’, ‘Discipline’ and ‘Moves’ is specific to ‘Classes’.
           Furthermore, the details of ‘Workouts’ are contained in ‘Sets’, a linked table with attributes such as ‘Weight’, ‘Reps’, etc.

           I wonder whether I should keep the three training types in only table ‘Sessions’ or keep the three types in its own distinct table?

           Your advice will be greatly appreciated. W.

        • 1. Re: How many tables to store loosely related categories?
          davidanders

               A database could have Contacts, Clients, and Vendors - all people, sharing most attributes, but some different.

               Clients would appear on Invoices and Payments, Vendors would appear on Purchase Orders.

               An argument could be made both ways, I would keep them separate.  Use and reporting makes more difference than shared fields.

          • 2. Re: How many tables to store loosely related categories?
            philmodjunk

                 There's definitely no clear "rules" to tell you what option is best. Some developers just keep to one table and add lots of fields that are empty for all but one type of record. Others use related tables for each, but they often then have a central table for those fields that are common to all categories and use separate related "detail" tables for each type to record the data that's different.