View Editor

Previous  Index  Next  How To Use

Views, basically stored SQL statements with a result set, are a powerful construct to hide implementation details from users. It also allows you to be "structure independent" in your application - if the underlying structure of the tables changes, and your application is using a view, you adjust the view - but not the application.


This View Editor enables you to create, alter and drop views, check it's output and export the result.


Below is an example, taken from the Firebird View Editor:

The Firebird View Editor


If you create a new view, the source edit box will use an Object Template to begin with.


The "{..}" button will turn the current line or text selection in the source edit box into a comment, or remove the comment from the current line.


See also: Object Template Editor


Adding/Dropping/Editting Columns

When creating a new view, you can let the database engine decide on what column names it should use if you like. Alternatively, you can add columns to the list at the right to create custom named columns. After a view has been created, you can rename column by simply modifying a column name.


If you decide to add another column after the view has been created, you always need to add the column to the list of columns on the right as well. Database Workbench will use the names in that list to construct the needed View modification statements.


The Add Column button will add a column or insert a column if you have the cursor positioned on a column name.


Viewing/editting Data

The Data tab shows the view data, by performing a simple "SELECT * FROM view" SQL statement. If the database engine supports it (updateable views), changes can be made to the data. Changes on this tab will not be saved unless you commit the transaction that is started when you modify data.


This tab also has a toolbar button to export the view data.