table design and relationship question

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
darrenb
Posts: 1
Joined: 2020-07-03 17:56

table design and relationship question

Post by darrenb » 2020-07-03 23:05

This question might be very basic, but I have watched some database design videos and still confused, so thought I would ask you guys for direction related to design.

Hypothetical example:

A database holding details of all the apartments in an apartment block, resident details and the food contents of each apartment.

To be able achieve various search results. For example:

What apartments have vegetables, what vegetables? and how many of each?


My initial thought path is to have the following tables:


Table: Apartment_block: Fields: ID, block_name

Table: Apartment_number: Fields: ID, apartment_number, name_of_resident

Table: Food_item: Fields: ID, product_category, product_name, qty


But am struggling in my head with the relationships.

For example: Would I be able to create a record by Adding an apartment and then in the same action, add what foods and quantity are in that apartment?

Or would I need to add the foods first, and then select the Apartment and add quantity of each food item in the Apartment?

Do I actually need more tables?

nycwebmaster
Veteran Member
Posts: 90
Joined: 2015-11-23 01:02

Re: table design and relationship question

Post by nycwebmaster » 2020-07-13 22:57

You should add first your main table and later on you should then start with the children tables. After you create the children tables then you should incorporate those foreign fields into the main table. After you do that Appgini will create "The Relationship" for you.

Does it makes sense to you?

Post Reply