Prev | Next |
Database Views
A Database View represents the results of a pre-defined query. Unlike a Table, a View is dynamically derived from data in one or more Tables (or other Views). Enterprise Architect supports the definition of Views both with and without this statement:
"Create View {viewName} As" statement
The system will automatically add it dynamically (if missing) whenever DDL generation is performed. The advantage of not defining this statement is that when a view object is renamed the 'View Definition' property does not have to be manually updated.
You can create a Database View either:
- Within the Database Builder or
- By dragging the 'View' icon from the Data Modeling Toolbox onto a diagram
Add a Database View with 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 'Views' Package and select 'Add New View'. |
|
4 |
Overtype the default name with the appropriate name for the View, and press the . |
|
5 |
Double-click on the new View, or right-click on it and select 'SQL Object Properties'. The 'SQL Object Editor' dialog displays. |
Add a Database View 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 (click on to display the 'Find Toolbox Item' dialog and specify 'Data Modeling'). |
|
2 |
Drag the 'View' icon onto the diagram.
This generates the View element:
|
|
3 |
Right-click on the new View element and select 'SQL Object Properties'. The 'SQL Object Editor' dialog displays. |
SQL Object Editor
The 'SQL Object Editor' dialog is shared by a number of SQL-based database objects (Views, Procedures, Functions and Sequences); it helps the data modeler manage the various properties of the SQL-based object.
Option |
Action |
See also |
---|---|---|
Database |
If it has already been set, the default database type displays. If the default has not been set, or you want to change the database type for this View, click on the drop-down arrow and select the target DBMS to model. |
Set the Database Type |
Dependencies |
A list of objects that the current object depends on. The 'Dependencies' list shows:
|
|
Notes |
If necessary, type in a comment on the current View. |
|
Definition |
Type the full SQL View definition. For releases of Enterprise Architect up to 12.1 (Build 1227), this must include the CREATE_VIEW syntax as appropriate for the target DBMS (for later versions this is not needed). For example: CREATE VIEW 'MyViewName' AS [view definition]
The code editor provides Intelli-sense for basic SQL keywords, functions and names of all objects in the current data model. |
Options - Code Editors Intelli-sense |
Learn more