For example, a smartphone might have attributes such as RAM and camera resolution, whereas a fridge has way different attributes. Is there a way to store these data in a relational database?

  • Read about EAV pattern.
    – Akina
    Dec 5, 2019 at 16:24
  • There's good and bad ways to do EAV, so keep in mind which data needs to be searched for and which is just retrieved. Note MySQL-8.0 and MariaDB-10.2(?) you can create virtual columns and index expressions on these.
    – danblack
    Dec 5, 2019 at 21:07

1 Answer 1


You probably have some columns that are common to almost all products: Price, SKU, Manufacturer, etc. Those may as well be columns. The rest can be put into a JSON string. More discussion: http://mysql.rjweb.org/doc.php/eav

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.