The basic structural element of a relational database is the Database Table, which represents a set of records, or rows, that have the same structure. Each row contains one or more columns. Every individual item of data entered into a relational database is represented by a value in a column of a row in a Table.
Enterprise Architect's UML Profile for Data Modeling represents:
|·||Database Tables as Classes with a stereotype of <<table>>|
|·||Database Table columns as attributes with a stereotype of <<column>>|
Before creating any database Tables in a Physical Data Model, it is recommended that you set the default DBMS for the model. The default DBMS then becomes the default database type for every new database Table element in the model, and the fields you complete are automatically tailored to support that database type. If you do not set the default DBMS, Tables are created without a default database type and the fields cannot be tailored to suit a database type.
You can set the default DBMS type using:
|·||The Project | Settings | Database Datatypes menu option, or|
|·||Tools | Options | Code Editors, or|
|·||The Code Generation Toolbar|
You can also create Primary and Foreign keys as Constraints of the Table.
This simple example of a Physical Data Model diagram in Enterprise Architect consists of two Database Tables represented by UML Classes, named SalesPerson and Customer. The Table stereotype is denoted by the icon in the top-right corner of each Class.
A simple Data model consisting of two tables, represented by UML Classes
Each Table defines three database columns, using UML attributes typed appropriately for the target DBMS (in this case, MySQL). To map Class attributes to Table fields, you can create connectors between specific attributes (features) in the Class element and the column attributes in the Table element.
Model Driven Architecture
Enterprise Architect can generate simple DDL scripts from your database model, to create the database Tables, Views and Procedures in the actual database. You can also perform Model Driven Architecture (MDA) Transformations to DDL - Enterprise Architect provides a template specifically for DDL transformations.