Tables and Columns
The basic structural element of a relational database is the 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>>. Columns are represented by Attributes with a stereotype of <<column>>. Tables and columns form the basis of Physical data models.
Enterprise Architect can generate simple DDL scripts to create the tables in your model. You can also perform Model Driven Architecture (MDA) Transformations to DDL - Enterprise Architect provides a template specifically for DDL transformations.
To help you 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.
A simple example of a Physical data model in Enterprise Architect is shown below. The example consists of two 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. The tables each define three columns using UML Attributes typed appropriately for the target DBMS, which happens to be MySQL.
A simple Data model consisting of two tables, represented by UML Classes
So far, Primary Key and Foreign Key information modeling is not discussed; this is considered in later topics.
- Create a Table
- Model Transformation
- DDL Transformation
- Connect to Element Feature
- Create Columns
- Primary and Foreign Keys