0

I need to store in db some info about item. I have *item_id*, *item_name*, but i don't know in advance how many info will have this item. One of the can have *item_info1* and *item_info2* , while another will have only *item_info1*. How i can realise this dynamic of the columns?. I think only about storing serialize info in a cell, but this way for getting separate *item_infoN* i must to request the full cell data. This is not comfortable way, I believe that there is another way to solve this problem. Thx!

1 Answer 1

2

Use another table.

Items
  item_id
  item_name

Item_Infos
  item_id
  item_info
Foreign Key item_id references Items(item_id)

You can have as many item infos as you want for any item.

Resources:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.