Database setup - joining tables

Hi All

New to the app and so far liking a lot of the features, i have been watching a lot of tutorials and it really is easy to sue for most parts.

I am struggling though with how to setup my database’s and fields. probably easier to explain what i am trying to achieve and then work back words.

My end result would be a product list of items ordered by a customer, this should include an image per order and the ability to edit one of the fields.

I could have around 400+ products, all with images and other attributes. Along with this i have over 1000+ customers (potentially).

So first database is Products, in here i have put Product Code, Product Name, Product Image

I then have a second database called Customer Orders, in here my thinking is that it will contain Product Code, Quantity Ordered, Quantity Received (where Quantity received will be the editable field)

How do i link these tables so when i do a repeating group it pulls through the image from the product table.

It is not realistic to have the image on each order as this will make it massive.

(On sql i would have a join on product code and bring the image through)

Any ideas would be greatly appreciated

relational database structure…google search and learn about that first

here is a link that is on every thread and forum on the subject of ecommerce database design

https://www.princeton.edu/~rcurtis/ultradev/ecommdatabase.html

Definitely, definitely spend some time off bubble to learn about database design and specifically relational databases.

In bubble you can relate on data type to another by having the data field in one data type be that of another data type.

ie: datatype = images with data field of products
datatype = products with data field of image

1 Like

Will give it a go, usually it is a simple foreign key in the secondary table that joins to the main table. (Which I had thought I had done with productcode in database 1 and productcode in database 2). I assumed I can then retrieve field from both. Like a normal sql query.

Thanks though, worth a read

You don’t need foreign keys in bubble to link tables. You do it via have a field with a “type” of another table. Far far simpler.

There are plenty of topics about how this works.

2 Likes

Worked it out NigelG

Was missing the part were you can select key field… once i found this then worked fine.

1 Like

yes, bubble uses the terminology of data types for tables and data fields ( which I suppose would be “keys” )

1 Like