I am student and learning MySQL now a days, I have created a CMS, everything is almost done, admin and user panel is ready but now I am facing some problem regarding table structure and need your help in this regard
Basically its a referral website user refer each other to get registration on website. All I have to display is referral structure in user panel.
Suppose A refer to B and B refer to C and C refer to D and so on. Like that A also refer G,H,I,J,K and C also refer X,Y,Z
I want to As user panel will display
Names of direct referral B,H,I,J,K
Names of 2nd direct referral C
Names of 3rd direct referral D,X,Y,Z

Please guide me which tables I have to create and also tell query to retrieve data from table.

I also have a table to store some basic info of user its stricter is this.
Id(primary key)
Referral name (the person who refer you on this website)

Please help me its really important for me