简体   繁体   English

使用 UML 类图设计数据库

[英]Database design using UML Class Diagram

I would like to design a database using UML class diagrams but I dont know how.我想使用 UML 类图设计一个数据库,但我不知道如何。 Can someone help me.有人能帮我吗。 How can I design a database using UML class diagrams?如何使用 UML 类图设计数据库?

Making an SQL database model in the form of a UML class diagram from a general information design model essentially requires to从通用信息设计模型以 UML 类图的形式制作 SQL 数据库模型本质上需要

  1. Represent all entity types (or better: classes representing object types) as classes stereotyped as «object table» using SQL datatype names and replacing the UML {id} property modifier with a «pkey» stereotype:使用 SQL 数据类型名称将所有实体类型(或更好:表示对象类型的类)表示为构造型为 «object table» 的类,并将 UML {id}属性修饰符替换为 «pkey» 构造型:

  2. Eliminate enumeration attributes for DBMS that do not support enumerations by connecting the object table with a corresponding enum table via a foreign key dependency arrow (a UML dependency stereotyped «fkey»):通过外键依赖箭头(UML 依赖构造型«fkey»)将对象表与相应的枚举表连接,消除不支持枚举的 DBMS 的枚举属性: 在此处输入图片说明 Otherwise, as in the case of MySQL, you can use their syntax in the model like so:否则,就像 MySQL 一样,您可以在模型中使用它们的语法,如下所示: 在此处输入图片说明

  3. Eliminate multi-valued attributes:消除多值属性:

    在此处输入图片说明

  4. Eliminate associations:消除关联:

    1. Replace any functional association with a foreign key dependency:用外键依赖替换任何功能关联: 在此处输入图片说明
    2. Replace any many-to-many association (relationship type) with a class stereotyped as «association table» and two foreign key dependencies:用构造型为“关联表”的类和两个外键依赖项替换任何多对多关联(关系类型): 在此处输入图片说明
  5. Eliminate generalization/inheritance relationships:消除泛化/继承关系:

    在此处输入图片说明

See this book chapter for more information.有关更多信息,请参阅本书章节

you may try to start with a UML class diagram.您可以尝试从 UML 类图开始。 Maybe you can find this tutorial useful - http://argouml-db.tigris.org/documentation/DB_UML_Guide.htm也许您会发现本教程很有用 - http://argouml-db.tigris.org/documentation/DB_UML_Guide.htm

You can additionally use "Relation scheme diagram" to design table relationship and clearly represent primary key / foreign key dependencies.您可以额外使用“关系方案图”来设计表关系并清楚地表示主键/外键依赖关系。

see this tutorial .请参阅本教程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM