shihabudheen
shihabudheen

Reputation: 696

How design user point system database?

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 enter image description here

2 method :- use coffe_points and sandwitch points as field_name wherever points data stored.

enter image description here

Which one is best approach?

Upvotes: 1

Views: 2778

Answers (1)

Nemeros
Nemeros

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

Related Questions