Good database design, variable number of attributes

后端 未结 4 1983
借酒劲吻你
借酒劲吻你 2021-02-04 10:16

I\'m trying to create a database that contains a list of equipment. All of the equipment will have certain common attributes (such as manufacturer, model #, serial #, etc.), the

4条回答
  •  深忆病人
    2021-02-04 11:00

    It's hard problem to solve for any SQL database. There is no great answer for MySQL.

    1) Works and you can add some views for important equipment types. It reduces the number joins and allows queries and indexes on each field.

    2) You can use a union all query in view. PostgreSQL and Informix have table inheritance.

    3) This is frequently an implementation choice. Again, you can use views for the joins.

    4) PostgreSQL, Informix, Oracle, IBM DB2 and MS SQL Server have an XML data type support to implement the value pairs.

    At higher level you could develop a meta model of the equipment in XML. Then you can use this model to generate schema SQL queries and CRUD code.

提交回复
热议问题