Database Sequences

Sequences are a feature that some DBMS products implement to provide users with a mechanism to generate unique values - the Sequence ensures that each call to it returns a unique value. This is particularly important when the Sequence's result is used as a Primary Key. These can be generated with a schema for loading onto the DBMS server.

Sequences are provided so that database users are not forced to implement their own unique value generator. Not all DBMS products support Sequences; those that do not instead provide functionality for columns to be initialized with an incrementing value.

In Enterprise Architect, Sequences can be modeled in one of two ways:

·As individual objects (the default method) or
·As Operations in a container

 

Functionally the two methods result in the same DDL being produced. The main difference is visual - by having several Operations in one container, you have fewer elements and less clutter on the diagram.

Individual objects

Sequences modeled as individual objects are UML Classes with the stereotype «dbsequence»; you create these by dragging the Sequence icon onto a diagram  from the Data Modeling Toolbox.

e_databaseseq

Toolbox Icon

databaseseq_icon

Operations in a Container

Sequences modeled as operations have a container object, this being a UML Class with the stereotype «sequences» (with an s on the end).  Each  Sequence is an operation with the stereotype «sequ». The system provides a dedicated maintenance window through which the modeler can easily manage the Sequences defined as operations.

 

seq_operations

 

Learn more