# Advice needed to structure database

**URL:** <https://forum.bubble.io/t/advice-needed-to-structure-database/150445>\
**Category:** Database\
**Created:** [May 9, 2021, 8:19pm UTC](https://forum.bubble.io/t/advice-needed-to-structure-database/150445 "2021-05-09T20:19:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SeanB](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/seanb/32/169120_2.png) [@SeanB](https://forum.bubble.io/u/SeanB)\
**Post date:** [May 9, 2021, 8:19pm UTC](https://forum.bubble.io/t/advice-needed-to-structure-database/150445/1 "2021-05-09T20:19:05Z")

</div>

Hi,

I need some advice to structure a database. I have one type called “Orders” and another type called “Products”. What I’d like to have is for each thing in Orders, I’d like it to reference a Product thing but also a qty for that product. In essence, I’d like for each Order thing to hold a product and a qty for that product. But the same Order could hold more than one products (items). So one order record/thing could have Product A, 100gms; Product B, 50gms, etc.

How would I structure my database for this? Because I thought that the Orders type would have a field called Products, which would be of list type, but then I’d even need to store the qty, so kind of a like a 2-D array within the field.

Also, perhaps I’m not thinking of this the right way to begin with? i.e. each order thing to hold more than one products so any advice/guidance is much appreciated.

Thanks.

---

<div class="post-metadata">

**Author:** ![boston85719](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/boston85719/32/77286_2.png) [@boston85719](https://forum.bubble.io/u/boston85719)\
**Post date:** [May 9, 2021, 8:38pm UTC](https://forum.bubble.io/t/advice-needed-to-structure-database/150445/2 "2021-05-09T20:38:36Z")

</div>

Might have a look at this post

> [@How to learn about database models and database structure](http://forum.bubble.io/t/how-to-learn-about-database-models-and-database-structure/77003):
>
> I feel that a lot of new users struggle with bubble, not just because there is a learning curve to the bubble platform itself, but because most are non-coders and do not have a background in database design. Personally, once I began to understand database design a bit more, it had profound impacts on how I was able to build using bubble, especially when it came to ease of manipulating data. I also feel, that a lot of new users forget about Google…that powerful search engine that can point you …

Could also consider another data type of order items

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [May 9, 2021, 8:46pm UTC](https://forum.bubble.io/t/advice-needed-to-structure-database/150445/3 "2021-05-09T20:46:08Z")

</div>

You’ll need a third datatype, to connect the product to the order, along with quantity (and any other data).

So you’ll want 3 datatypes:

Product  
Order  
Ordered-Product (or Order Item)

The order will contain ‘Ordered Products’.

The Ordered Product will contain a Product and a Quantity.

Definitely check out the post @boston85719 linked to above for some great resources for more info on database design and structure (as setting your database up correctly from the start will save you a lot of hassle in the long run). I’ve just looked at it and it’s got some great info and examples for DB setup.

---

<div class="post-metadata">

**Author:** ![SeanB](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/seanb/32/169120_2.png) [@SeanB](https://forum.bubble.io/u/SeanB)\
**Post date:** [May 10, 2021, 5:03pm UTC](https://forum.bubble.io/t/advice-needed-to-structure-database/150445/4 "2021-05-10T17:03:05Z")

</div>

Thank you. I’ll definitely check out the post and reference articles. Appreciate the help.

---

<div class="post-metadata">

**Author:** ![SeanB](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/seanb/32/169120_2.png) [@SeanB](https://forum.bubble.io/u/SeanB)\
**Post date:** [May 10, 2021, 5:04pm UTC](https://forum.bubble.io/t/advice-needed-to-structure-database/150445/5 "2021-05-10T17:04:03Z")

</div>

Thank you @adamhholmes This helps clarify things.

---

<div class="post-metadata">

**Author:** ![snour27](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@snour27](https://forum.bubble.io/u/snour27)\
**Post date:** [May 10, 2021, 5:08pm UTC](https://forum.bubble.io/t/advice-needed-to-structure-database/150445/6 "2021-05-10T17:08:26Z")

</div>

You could also have Type - Product with a field Qty in it.

---

<div class="post-metadata">

**Author:** ![boston85719](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/boston85719/32/77286_2.png) [@boston85719](https://forum.bubble.io/u/boston85719)\
**Post date:** [May 10, 2021, 6:51pm UTC](https://forum.bubble.io/t/advice-needed-to-structure-database/150445/7 "2021-05-10T18:51:28Z")

</div>

That would be more for an idea of inventory tracking rather than order tracking.

---

<div class="post-metadata">

**Author:** ![snour27](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@snour27](https://forum.bubble.io/u/snour27)\
**Post date:** [May 10, 2021, 7:25pm UTC](https://forum.bubble.io/t/advice-needed-to-structure-database/150445/8 "2021-05-10T19:25:38Z")

</div>

I see. Thanks dude.
