Hello,
This is a trivial task, SQL allows you to store recursive data into plain table.
For example in the most simple variant you may have 3 tables:
Tournament (tournament data and other stuff)
Player (player data)
Match [
- id
- tournament_id,
- player1_id,
- player2_id,
- outcome (0,1,2 or any other possible outcome that the reglament permits)
- level (starting from 0, it increases each round)
- ... additional data
]
For the given example Match table will look like (id and tournament ids are skipped):
[A,B,1,0] A wins
[C,D,0,0] no winner
[E,F,2,0] F wins
Now if A plays against F and wins we will have
[A,F,1,1] - now the level is 1.
This will allow easy tracking of the results and displaying stats.
Of course the final desing will depend on any additional reqirements you have in order to make it useful. For example if the bracket is seeded (like in Tennis) and what questions do you need the database to answer.
Looking forward to working with you!
Best regards,
Atanas