Forum Moderators: open
I have 3 different types of groups
Group1 is for a particular product
Group2 is for a particular retailer
Group3 is for a particular amount
The rest of the fields are same for all groups.
So is this a good way of doing this:
groupID ¦ groupName ¦ Description ¦ startedBy ¦ groupType ¦ productID ¦ retailerID ¦ Amount
--------------------------------------------------------------------------------------------
1 ¦ test1 ¦ testing1 ¦ <userID> ¦ 1 ¦ <productID>¦ null ¦ null
2¦ test2 ¦ testing2 ¦ <userID> ¦ 2 ¦ null ¦ <retailerID> ¦ null
3¦ test3 ¦ testing3 ¦ <userID> ¦ 3 ¦ null¦ null¦ 24000<userID> --> refers to user table
<productID> --> refers to product table
<retailerID> --> refers to retailer table
OR should I be creating a base group table and three other tables for each group
Group
---------
groupID
groupName
Description
startedBy
groupTypeGroupType1
----------
groupID
productID
GroupType2
----------
groupID
retailerID
GroupType3
----------
groupID
amount
A group basically refers to a group of users. There are other tables involved like GroupMembers that store all the members that belong to a particular group.
Coming back to your suggestion, that was my original idea too, to go with the second approach. But then I was thinking, just to capture 1 extra field like productID or retailerID or amount - should I create 3 new tables.
But I guess since not all groups are going to have all three values, it makes sense to capture them in a different table.
Thanks for your input.