Database Structure involving dynamic fields

You have reinvented an old antipattern called Entity-Attribute-Value. The idea of custom fields in a table is really logically incompatible with a relational database. A relation has a fixed number of fields.

But even though it isn't properly relational, we still need to do it sometimes.

There are a few methods to mimic custom fields in SQL, though most of them break rules of normalization. For some examples, see:

  • Product table, many kinds of product, each product has many parameters on StackOverflow
  • My presentation Extensible Data Modeling with MySQL
  • My book SQL Antipatterns: Avoiding the Pitfalls of Database Programming