Thoughts...Understanding the concept of the database in Bubble

Hi All

I’ve been struggling with the database, specifically linking data types/tables. Were it not for some spectacularly kind people on here taking the time to guide me, I’d probably have given up so I’m indebted to those who’ve helped me. Thank you all.

I think I’ve now managed to get my head round the concept of the database and how it works with my app and wondered if anyone could support or correct my thinking . Once I’ve got this sussed, I feel I’ll finally be on my way.

My thinking is that Bubble is building apps that contain data and not for building databases (I know that sounds obvious but stick with me) so I can pretty much forget about 0ne to Many and One to One relationships with inner and outer joins etc because Bubble’s simpler than that. To link two “tables” (ie data types) I just put in a field in one table and set that field’s data type to be the name of the table (data type) I want to link it to. I don’t even have to put any data in that field. It acts as an informational pathway along which Bubble can move data between tables. In order to pull data across this pathway I use “apostrophe language” in dynamic expressions in an element’s properties on pages such as “Value” = “Current User’s” “FirstName” or “Do A Search For” “Product’s” “Price” etc (if I have a Price field in a Product’s table). That’s how I push data to a table and pull it from another one. Obviously there are lots more expressions I can use but I’m new to this and haven’t learn them yet.

Does my thinking about this make sense? Have I missed anything or am I barking up the wrong tree completely? I’d love it if someone who knows can add their experience and I appreciate that this is very generalised thinking but, for my tiny brain at least, it’d give me confidence if I’m on the right lines.

As ever, thank you so much for reading this far.

I was just thinking about this earlier today. One thing I really like about SQL tables is that option to do one too many and one to one relationships. It’s my understanding that these make searches And data retrieval in a typical SQL database much faster and more accurate… it’s also my understanding that when using a list of things as a feel type in a different thing is useful until you have “too many “items in that list.

One thing a traditional SQL database has over a bubble search is that you can send parameters with your search to the SQL table. The server does the data filtering. With a bubble search the filtering is done client side.

Hello!

This is how linking tables is done in “bubblish”:

Hope this makes sense :slight_smile:

1 Like

This might help

1 Like

The low-code platform I was using before was based on a “traditional” database structure, and the only real difference I’ve seen with that setup vs. Bubble’s is that in Bubble you can make a database field a “list”. This makes many-to-many relationships so much easier to establish and manage. With a traditional database, you’d need to use a joining table, which can be a major pain if you have a lot of many-to-many relationship types. You can use such a table in Bubble, but it’s not required.

The list field also provides an additional option with one-to-many relationships, in that you can flip the direction of the link and have the list exist within the field (but avoid sticking too long a list in there).

So with Bubble you can establish relationships as one-to-one, one-to-many, many-to-many – whatever you want – and link them (ie set up the parent/child) in either direction or both.

To clarify some other things:

  1. I haven’t seen any accuracy issues related to Bubble’s setup
  2. You can run almost all Bubble searches server side which is typically fast. Some searches (like searching a list based on a list) have to be done client side and are slower.
  3. If you are coming from an inner/outer join mindset, this link may help:
    SQL Joins Vs Bubble

Finally, I highly recommend the book by @petter on performance, since a lot of what drives performance is using the optimal database setup for your dataset and how you plan to search and show information. The flexibility Bubble provides is great, but that flexibility (and multiple ways of doing things) also means you can go down pathways that aren’t the best. Once you have the fundamental understanding of how Bubble works, the right approach falls pretty easily out of that.

2 Likes

This is very helpful. Thank you.

Thank you. I hadn’t come acress the “intersect” option. This helps me make a big leap forward too!

Thank you for taking the time to reply to my query. I like the way that Bubble has similar power to SQL databases but seems more user friendly.

@cmarchan
I have doubt, that If we already have database and API for accessing that, then should we use this bubble database like we do coding in java . Declaring variables and allocating memeory for the same.The bubble database also works the same way?

The one who having DB should use this or not? I means is it a good practice?