13

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?

user3167689
  • 151
  • 2
  • 2
  • 5
  • possible duplicate of [UML class diagram for database](http://stackoverflow.com/questions/21231096/uml-class-diagram-for-database) – Rolf Schorpion Jan 26 '14 at 11:35

3 Answers3

26

Making an SQL database model in the form of a UML class diagram from a general information design model essentially requires to

  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:

  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»): enter image description here Otherwise, as in the case of MySQL, you can use their syntax in the model like so: enter image description here

  3. Eliminate multi-valued attributes:

    enter image description here

  4. Eliminate associations:

    1. Replace any functional association with a foreign key dependency: enter image description here
    2. Replace any many-to-many association (relationship type) with a class stereotyped as «association table» and two foreign key dependencies: enter image description here
  5. Eliminate generalization/inheritance relationships:

    enter image description here

See this book chapter for more information.

Gerd Wagner
  • 5,481
  • 1
  • 22
  • 41
2

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

Leo
  • 6,480
  • 4
  • 37
  • 52
1

You can additionally use "Relation scheme diagram" to design table relationship and clearly represent primary key / foreign key dependencies.

see this tutorial.