user1787489
user1787489

Reputation: 1007

Should i put information about an item in a different table than the item's product/parent_ID? MYSQL

I have a store database with a list of stores, their ID, and 5 rows for their 5 levels of parent/grandparent ID's.

I also have store information such as address, phone number, products, etc, but all of these rows are in a separate table which also has store name and store ID, but not parents.

Currently i have all the store information in a separate table from the store IDs, and if i ever need to relate the parent ID to the info i connect the two using the store_ID.

So essentially the redundant rows "store_Id" and "store_name" could be removed if i made everything into one table.

But is that proper form or not?

Upvotes: 0

Views: 40

Answers (1)

G-Nugget
G-Nugget

Reputation: 8846

As long as you don't need a historical record of past properties of a store, i.e. you don't need to know that a store moved from address1 to address2, you only need to know the current address, then I would combine the tables. It probably won't make a noticeable difference as far as performance, but having the data in one table is easier than having to JOIN when needed. It will also save some storage space on the redundant columns and indexes. With the amount of data you're storing and how it's related, you don't gain much from storing the details in a second table. If you had 20 TEXT columns for each store, then you could benefit from a details table, but as it is, you don't need it.

Upvotes: 1

Related Questions