database 使用 UML 类图设计数据库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21358774/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Database design using UML Class Diagram
提问by user3167689
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 类图设计一个数据库,但我不知道如何。有人能帮我吗。如何使用 UML 类图设计数据库?
回答by Gerd Wagner
Making an SQL database model in the form of a UML class diagram from a general information design model essentially requires to
从通用信息设计模型以 UML 类图的形式制作 SQL 数据库模型本质上需要
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: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 multi-valued attributes:
Eliminate associations:
Eliminate generalization/inheritance relationships:
使用 SQL 数据类型名称将所有实体类型(或更好:表示对象类型的类)表示为构造型为 «object table» 的类,并将 UML
{id}属性修饰符替换为 «pkey» 构造型:通过外键依赖箭头(UML 依赖构造型«fkey»)将对象表与相应的枚举表连接起来,消除不支持枚举的 DBMS 的枚举属性:
否则,如 MySQL,您可以使用它们的语法在像这样的模型中:

消除多值属性:
消除关联:
消除泛化/继承关系:
See this book chapterfor more information.
有关更多信息,请参阅本书章节。
回答by Leo
you may try to start with a UML class diagram. Maybe you can find this tutorial useful - http://argouml-db.tigris.org/documentation/DB_UML_Guide.htm
您可以尝试从 UML 类图开始。也许您会发现本教程很有用 - http://argouml-db.tigris.org/documentation/DB_UML_Guide.htm

