Question about a database, since as I see bubble doesn't do something like SQL joins

So hello guys, I am a complete beginner to bubble, and i would be really glad if someone could help me out.

So firstly, let’s say i have a database which is consisted of 3 tables: Players, Teams, LinkPlayersTeams.

Attribute of table Players: Name,Surname,Height,Weight
Attribute of table Teams: TeamName,CountryName,Titles
Attribute of table LinkPlayersTeams: UniqueKey,Player,Team,StatusOfAPlayer

Note: StatusOfAPlayer is an enum, oculd be active,inactive,etc…also, attributes Player and Team should be references i guess or a whole object which represents an entity in table Players, or Teams.

So let me finally get to my question… :smiley: How do i make this work in bubble, what is the best approach with associative classes, agregations, etc in bubble.

Also, if you have some helpful material i can further learn, which helped you, feel free to send me, I would love that. :smile:

Thank you guys for your attention, sorry for the long post, hope it finds you well…

1 Like

You can totally design it as you did. However, data will not be intuitive. And by intuitive I mean the design I mention below.

Yes, the Player, Team objects in the LinkPlayersTeams table will be the exact objects, no IDs or anything. Bubble handles this automatically.

You can technically do this in 2 tables as well.

You will have a Team and Player data type and then Team data type will have a field called Players of type Player data type. Bubble handles the joins etc automatically.

For the associative classes, if you want to just add a flag like StatusOfAPlayer, I would probably have a list of Active Players (of type list of Player) and Inactive Players (of type list of Player) in the Team data type.
image

If you want to add more than just a flag to a relationship (associate classes), you can name it like a TeamPlayer and put all the flags in there. But even in this case, I would probably have a Team. Then, Team has a list of Team Players (of type list of Team Player). Each team player has a Player (of type Player).
image

This is just me though. I don’t know the performance implications too much. Technically, the data is supposed to be modeled closer to the real life than technical life (db, sql etc) :slight_smile:

2 Likes

You create your relationships via assigning a field in a table to another tables type, which will basically be the uid for that foreign table’s record, and allows you access to all the fields within that table.

1 Like

Wow thank you so much, I will try my best to make this work, thanks for a thorough explanation, I really appreciate it!

Understood, thank you so much!