-1

So my blocker is that I want to design a tournament management system but with one key note: tournament could be for both teams AND players. I saw different questions with answers around how to design a system but all of them described the tournament system for teams. And what I'm looking for is the system that could handle both (for example) soccer tournament (teams) and tennis tournament (players).

Currently the only way that I see this is to do two different tables - one for team tournaments and one for player tournaments. I don't see how I can merge two tables into one. But I don't like the idea of having two tables for tournaments

So do you see how this could be done? If yes please share your thoughts. Thanks in advance!

Viaches
  • 143
  • 1
  • 16
  • Possible duplicate of [How can you represent inheritance in a database?](https://stackoverflow.com/questions/3579079/how-can-you-represent-inheritance-in-a-database) – philipxy Jan 26 '19 at 00:18
  • Thanks for your answer! I don't think it's a duplicate as I don't have the issue with 'inheritance' (I think)... So I don't have the 'three tables that have something in common' problem, From my point of view there is no inheritance in my case... – Viaches Jan 26 '19 at 21:02
  • "Types" of something = subtypes = inheritance. Also: It would be helpful if you gave more details of your design/programming. "how this could be done" & "share your thoughts" are not on-topic questions here. – philipxy Jan 27 '19 at 00:19

1 Answers1

1

There are some database system which provide the concept of inheritance Also you can make a table

Enitity (prim, [sharedProperties], entityTpe, ref)

where entityType says 'P' or 'T'.

Team (prim, [teamProperties])
Player (prim, [playerProperties])

based on this you can create a single view e.g. 'TeamPlayer', where you can get your entities based on your business case

Hero1587
  • 68
  • 5
  • Thank you! Am I understand you correct that in your solution we also need to have next tables: 1) TournamentTeams - to know what teams are involved into tournament that was created for teams 2) TournamentPlayers - to know what players are involved into tournament that was created for players ? – Viaches Jan 26 '19 at 21:05
  • yes but there is not a single 'real right' way to design a concept of inheritance. There are a few different ways. Try to search for generalization/sepcialization. At least i would create a single view which aggregates all teams and players to keep it handy – Hero1587 Jan 28 '19 at 06:35