使用 UML 类图设计数据库 [英] Database design using UML Class Diagram
问题描述
我想使用 UML 类图设计一个数据库,但我不知道如何.有人能帮我吗.如何使用 UML 类图设计数据库?
I would like to design a database using UML class diagrams but I dont know how. Can someone help me. How can I design a database using UML class diagrams?
推荐答案
从通用信息设计模型以 UML 类图的形式制作 SQL 数据库模型本质上需要
Making an SQL database model in the form of a UML class diagram from a general information design model essentially requires to
将所有实体类型(或更好:表示对象类型的类)表示为构造型为对象表"的类;使用 SQL 数据类型名称并将 UML
{id}
属性修饰符替换为 «pkey»刻板印象:
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:
通过外键依赖箭头(UML 依赖构造型 «fkey»)将对象表与相应的枚举表连接起来,消除不支持枚举的 DBMS 的枚举属性:否则,就像 MySQL 一样,您可以在模型中使用它们的语法,如下所示:
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»): Otherwise, as in the case of MySQL, you can use their syntax in the model like so:
消除多值属性:
消除关联:
- 用外键依赖替换任何功能关联:
- 用构造型为关联表"的类替换任何多对多关联(关系类型);和两个外键依赖项:
消除泛化/继承关系:
Eliminate generalization/inheritance relationships:
有关详细信息,请参阅本书章节.
See this book chapter for more information.
这篇关于使用 UML 类图设计数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!