Hello I am creating a webapp and i am going to design the database, i discovered this. Could it be a poor design to possess more then 1 outcomes of 2 tables? The image i've published is an extremely fast and small example just to really make it clearer. If i must display all of the offers,i must place even the items they are based on, within this situation i possibly could retrieve the merchandise title by developing a product instance retrieved using the product id in the product id area within the offer object, however it would require more queries execution and much more typing work, so i believed to incorporate the merchandise title directly within the offer to ensure that i'm able to simply retrieve all offers and finally display the attached product by browsing the DB using its product id. Can you think about this a poor approach? I've been searching around for cases like mine however i only have found approaches with 1 link between tables (with unique id's) Thanks
This really is data denormalization. Do not do it (generally). Design the tables properly, allow the database perform the correct use the right queries. It will likely be much simpler to keep and use with time.
Make use of the ID within the offer table to research the merchandise title within the items table.
yes this is bad.
getting rid of the redundant title could be proper normalization. just link around the id, that'll be the easiest way.
Generally there's no limit to the amount of associations (links) between two tables, but each relationship must have a distinctive meaning. If, inside your example, Product Title and Product ID are generally candidate secrets and every title has exactly the same ID then you definitely should certainly not have two PK/FK associations between these tables.
@Joe is appropriate. Normalization is the greatest strategy to use with database design. It is because to ensure that additions, deletions, and modifications of the area can be created in only one table after which propagated with the relaxation from the database through the defined associations.