Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Database SQL Queries

An SQL Query object provides a convenient mechanism for storing an SQL Statement in the repository, for repeated execution on live database(s).  

An SQL Query element is represented in the UML Data Modeling Profile as an Artifact element with the stereotype <<sqlquery>>. You can create these elements either:

  • Within the Database Builder or
  • By dragging the SQL Query icon from the Data Modeling Toolbox onto a diagram

Add a Database SQL Query using the Database Builder

Step

Action

See also

1

Open the Database Builder.

The Database Builder

2

Load or create a Data model.

3

Right-click on the Queries Package and select Add New SQL Query.

4

Overtype the default name with the appropriate name for the Query, and press Enter.

5

Right-click on the new element and select 'Edit'.

The 'SQL Scratch Pad' tab displays, on which you can create the SQL Query statement.

Test DDL Script Statements

6

When you have finished the SQL statement, click on the Save to SQL Query button in the toolbar to save the changes to the query element.

Add a Database Function to a diagram

Step

Action

See also

1

Open your Data Modeling diagram and, if necessary, display the Data Modeling page of the Diagram Toolbox (More tools | Data Modeling).

2

Drag the 'SQL Query' icon onto the diagram.

This generates the SQL Query Artifact element:

3

Double-click on the new element and update the element name and other properties as necessary.

To edit the element's SQL statement, access the Database Builder, click on the element in the Queries Package and edit the Query on the 'SQL Scratch Pad' tab.

Test DDL Script Statements