Link to home
Start Free TrialLog in
Avatar of moombaz
moombaz

asked on

SQL to UML

I am translating an SQL codes into a UML diagrams.

How do I draw a UML diagram if my class attribute is a UNIQUE key. Any reference for me to refer or learn to translate SQL codes into UML diagram?

An example of the SQL code is

CREATE TABLE table2(
attr1            VARCHAR(20)      NOT NULL,
attr2            NUMBER(2)      NOT NULL,
attr3            NUMBER(2)      NOT NULL,
attr4            NUMBER(8)      NOT NULL,
      CONSTRAINT table2_PK PRIMARY KEY(attr1),
      CONSTRAINT BkJissue_CK1 UNIQUE(attr2, attr3, attr4)
ASKER CERTIFIED SOLUTION
Avatar of Reza Rad
Reza Rad
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi moombaz,

There is no direct UML diagram that translates to a table. The best that UML can provide is a UML Profile or using sterotypes on a class diagrams. This is not an ERD as such but it does let you specify primary keys and constraints but normally only as notes. I'm not sure there is a tool that will translate these into actual tables or vice versa.

Here is an example.

http://www.agiledata.org/essays/umlDataModelingProfile.html

I'd just use an ERD as reza_rad said.

Cheers,

Darren
Hi,
 UML has OCL to defain constraints.
Regards,
Franck.