What is a Column?
The basic organizational element of a relational database is the Column. Every individual item of data entered into a relational database is represented as a value in a column of a row in a table. Columns are represented in the UML Data Modeling Profile as a stereotyped attribute; that is, an attribute with the Column stereotype.
Note: For MySQL, before creating columns first add ENUM and SET datatypes. Select the menu option and, on the Database Datatypes dialog, in the field select . Add the datatypes ENUM and SET.
To create columns, follow the steps below:
|·||Click on the icon on the Data Modeling page of the Enterprise Architect UML Toolbox and drag it onto the name of the Table element; when prompted to do so, type in the column name and data type, then double-click on the column name in the Table|
|·||Right-click on the Table in a diagram to open the context menu, and select the menu option. |
|2.||The Table n Attributes dialog displays.|
|3.||If you started with the Attributes context menu option, type in the column and and click on the button.|
Tip: If the drop-down list of datatypes is empty, this means that you have not selected a target database for the table. Close the Columns dialog and re-open the Table Properties dialog to set a before continuing. To prevent this recurring, set the default database type.
|4.||The following fields for each column are optional:|
|·|| - select the checkbox if the column represents the primary key for this table|
|·|| - select the checkbox if empty values are forbidden for this column|
|·|| - select the checkbox if it is forbidden for any two values of this column to be identical|
|·||- type a value that can be used as a default value for this column, if required|
|·|| - click on the drop-down arrow and select a scope of , or (the field defaults to )|
|·||- type an alternative name for the field (for display purposes), if any|
|·|| - type any other information necessary to document the column.|
Note: Some datatypes, such as the Oracle NUMBER type, require a precision and scale. These fields are displayed where required and should be filled in as appropriate. For example, for Oracle:
create NUMBER by setting = and =
create NUMBER(8) by setting = and =
create NUMBER(8,2) by setting = and = .
Note: Oracle VARCHAR2(15 CHAR) and VARCHAR2(50 BYTE) datatypes can be created by adding the tag LengthType with the value CHAR or BYTE.
Note: For MySQL ENUM and SET datatypes, in the field type the values as a comma-separated list, in the format ('one','two','three') or, if one value is the default, in the format: ('one','two','three') default 'three'.
Change the Column Order
To change the column order, follow the steps below:
|1.||On the Columns dialog, highlight a column name in the Columns panel.|
|·|| button to move the column up one position|
|·|| button to move the column down one position.|