Is there a method for storing one-to-many relationships within a table? Say I had a Player, and the player had multiple Tickets. How could I store multiple ticket primary keys within one player?

2 Answers 2


Even if you do not directly support one-to-many, you can set up multiple indexes to:

Create a separate player, ticket struct. These become tables. Place a player_id in the ticket and create a secondary index using player_id. You can search for the player's tickets by using both the player_id and the ticket id.

The following links can help. https://developers.eos.io/eosio-cpp/docs/multi-index-table-tutorial

  • Ahh of coarse, I've worked with graph databases for so long that I'm no longer used to the old way of look ups. I realised you could even use the scope to do some tricky "grouping" like actions on tables. Jun 17, 2018 at 4:06

The link below will be really helpful. There are many concepts and relationships between them.


  • Why answer twice? You can edit your questions and answers.
    – Vlad
    Jun 16, 2018 at 19:40
  • I like the vector implementation, thank you! Jun 17, 2018 at 4:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.