Home  >  Q&A  >  body text

mysql - database table structure design

Describe the requirements:
Now we need to design the database table structure. There are many types of rules. How to design tables to store these rules. Each rule has common attributes and different attributes. At present, I have thought of two methods: the first is through foreign keys (common attributes are in one table, and the different attributes of the rules are placed in another table); the second is through wide fields (the different attributes of the rules are placed in a large field Save it);
May I ask the masters if there is a more efficient way.

習慣沉默習慣沉默2668 days ago1015

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-06-30 09:57:23

    Simple, JSON strings are stored in the database

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-06-30 09:57:23

    The person above is right, you can directly save it as a json string! It is also convenient to operate
    Now mysql5.7 explains the JSON series operation functions in Mysql in detail

    reply
    0
  • typecho

    typecho2017-06-30 09:57:23

    In short, don’t try to extract what is common. .

    reply
    0
  • Cancelreply