Modeling Database View
A database view is the result of a query on the data stored in a database. You can select columns, specify where and join statements to a view and present the data as if the data were coming from one single table. In Visual Paradigm, you can edit database view in a visual editor.
Creating database view
A database view is represented visually with a View shape. You can create a database view from the diagram toolbar or from the entities involved in the database view.
From diagram toolbar
You can create a database view and then edit it by specifying the entities involved. To create a database view:
- Select View from the diagram toolbar.
Select View from diagram toolbar
- Click on the diagram to create a view.
- Enter its name and confirm.
Database view created
You can now specify the entities involved in the view via the View Editor. To open the View Editor, right click on the background of ERD and select Show Table Record Editor or View Editor from the popup menu.
- On the right hand side of the View Editor. Click on the add button. Then, select the entities that are involved in the view and click Apply.
Add some entities to a view
Entity added to view
Instead of creating a blank view and adding entities into the view, you can create a view directly from entities that are involved in the view. To create a database view from entities involved:
- Select the entities in ERD.
Select entities to create view
- Click Create View in the View Editor. The View Editor is placed under the ERD. If you do not see it, right click on the background of ERD and select Show Table Record Editor or View Editor from the popup menu.
To create view
View formed from multiple entities
A database view contains rows (i.e. the results) and columns, just like a database table. To select columns, simply click on the checkbox of the desired column. Alternatively, select the column in the Column column in the View Editor.
Joining of columns between entities can be done by the resource-centric interface. To do this:
- Click on the source column in the entitiy in View Editor.
- Press on the desired resource and drag it out.
To join columns
- Drag to the target column and release the mouse button.
Editing database view in View Editor table
There is a table under the visual view editor where you can configure a view's column alias, sort order, grouping, function, filter, etc.
|Editing the alias of column
|Database view table editor
The following table lists out the filters you can enter in the Filter field.
The following resources may help you to learn more about the topic discussed in this page.
|7. Entering Sample Table Records for Entities||Table of Contents||9. Modeling Stored Procedures in ERD|