Reputation: 696
In my application ,there is two pointing system. coffeepoints and sandwich points. I am looking best approach to design database.
Coffee points :- When user purchase coffee, he will earn coffee points sandwich points :- When user purchase sandwich he will earn in sandwich points
1 method :- Create a table, point_types to store points name such as coffe points and sandwitch points
2 method :- use coffe_points and sandwitch points as field_name wherever points data stored.
Which one is best approach?
Upvotes: 1
Views: 2778
Reputation: 425
In a pure conceptual modelisation point of view the first solution is the way to go.
It gives your model flexibility and answer to the case without breaking normal forms.
I wouldn't implement the second solution, till you would have to work on several sql query if your fonctionnality ever evolve (10% chance)
Upvotes: 4