If you know most of the attributes your products will have ahead of time, you could hard-code them into the tables for different product types, such as:
books
-----
id
price
title
author
isbn
etc....
mobile_device
-------------
id
price
size
colour
model
etc...
You could also try something like this:
base_product
------------
id
base_price
product_type
book_product_attributes
-----------------------
base_product_id (FK to base_product)
title
author
mobile_dev_product_attributes
-----------------------------
base_product_id (FK to base_product)
model
colour
This way, you can group your common attributes in a base product table, and more specific attributes are stored in other tables when necessary.
This will work if your product types are mostly static. On the other hand, if you have no idea what product types or attributes you'll need in the future, and entity-attribute-value based system might work better. The idea behind that model is that you have a table for the different attributes you might have, a table for the different entities in your system, and a table for the attribute values that an entity has. Example:
entities
--------
id
attributes
----------
id
name
values
------
id
entity_id
attribute_id
value
The data might look like this:
entities
ID
----
1
attributes
ID | name
----------
1 | title
2 | author
values
ID | attribute_id | entity_id | value
---------------------------------------------------------
1 | 1 | 1 | "Great Expectations"
2 | 2 | 1 | "Charles Dickens"
This data very briefly describes a product which has two attributes: title, and author, with the valus "Great Expectations" and "Charles Dickens", respectively.
Be aware that using an EAV database can make queries very awkward. With enough data and the wrong model design, it's also possible to run into performance problems. The example I gave was very simple but more realistic designs tend to be more complicated than that. It can take time to get this kind of database correct and it's not always the best solution.
You have pretty much 4 choices:
NoSQL - definition Every record is stored as a set of Key/Value pairs. It is very flexible and fast. Not all of the report writers out there support this style of storage. There are many example database implementations of NoSQL. The one that seems to be most popular right now, is MongoDB.
EAV - definition This is where you turn either the whole table or a portion (in another table) on its side. This is a good choice if you already have a relational database in-house that you can't move away from easily. The custom info table example you gave is a good example of an EAV table.
Standard tables with XML columns - Think of this as NoSQL meets relational tables. The data stored in an XML column can be any format that XML supports, including multiple correlated sub-data. For the columns that you know are going to be "regular" columns, they can be built as the appropriate type of column to store the data (LastName, Address, City, State, etc.).
Standard tables with lots of extra columns - You have a relational database, you can't use either XML or EAV, and NoSQL is not an option. Add lots of extra columns of each type. I would guess 30 or more varchar, 30 or more integer, 15 or more numerics. And once you use a column for a value, don't re-use it. And don't delete the column either.
Out of all of these solutions, my own opinion is that you will find either the NoSQL or the EAV approach to be the most successful with the least amount of refactoring your code and your schema.
You will have a situation where you collect data one year, not the next, and then collect it again afterward. Trying to get the older data updated with the correct information is problematic and expensive. Storage is neither.
Best Answer
I'd go for something like:
menu_item_items
andmenu_items
probably need better names (dishes formenu_items
, perhaps?).