SQL to UML

moombaz
moombaz used Ask the Experts™
on
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)
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Consultant, Trainer
Commented:
you can translate sql code to ERD diagram, by tools like this:
http://www.datanamic.com/


DarrenSenior Software Engineer

Commented:
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.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial