K
K
Kirill2015-01-05 16:57:40
PHP
Kirill, 2015-01-05 16:57:40

What is the best way to store the data of a 7-level affiliate program in the database in one table or in different ones?

Guys, hello!
Such a theoretical question - how best to store data? In different tables or in one?
Now I have such a structure - the USER table and it contains - ref1, ref2, ref3, ref4, ref5, ref6, ref7.
But such a structure confuses me, on the one hand it seems to be convenient, but this is probably not correct, because. there will be duplication of data, which is good according to the rules of normalization.
Accordingly, the idea arises to create 7 separate tables - Level1, Level2, Level3, Level4, Level5, Level6, Level7.
But then the question arises, what to write in these tables? If someone has experience, please tell me how best to do it. I just started writing code, but this is something that confuses me. It's just a question of how to track the data when paying partners. And will there be many queries to the database?
I would be very grateful if you share your experience - please do not send books and books to Google, I have already rummaged through a ton of material. I implemented a one-level affiliate program, but here is the question.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SagePtr, 2015-01-05
@Lobanov

As one Nested Set

D
Dimitri, 2015-01-05
@Kvarkas

Node.JS & MongoDB seem to help you with this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question