Skip to content

Working with Views

Some of the features on this page are only in DbVisualizer Pro.

A view is a stored SELECT statement that you can query like a table. In DbVisualizer, you work with views mostly as with tables. This page describes what is different, and links to the table pages for the rest.

Creating a view

For most databases, there is no dialog for creating a view. Instead, you execute a CREATE VIEW statement in SQL Commander:

  1. Write the SELECT statement of the view, or create it in the Query Builder and copy it to the SQL editor.
  2. Add CREATE VIEW name AS before the SELECT statement.
  3. Execute the statement.

For Oracle, BigQuery and NuoDB, you can also right-click the Views node in the Databases tab and select Create View. Enter the name and the SELECT statement, and click Execute. For Oracle, the dialog uses CREATE OR REPLACE VIEW, so you can also use it to change a view.

Changing a view

There is no dialog for altering a view. To change it, you create it again with a new SELECT statement:

  1. Double-click the view in the Databases tab, and select the DDL tab in its Object View tab. The DDL tab is only in DbVisualizer Pro.
  2. Right-click the DDL and select Copy to New Editor. The CREATE VIEW statement opens in a new SQL Commander tab.
  3. Change the SELECT statement. To change it in the Query Builder, copy only the SELECT statement to an empty SQL Commander tab, and click Load SQL into the Query Builder. The Query Builder loads all text in the editor.
  4. Drop the view: right-click it in the Databases tab and select Drop View.
  5. Execute the changed CREATE VIEW statement.

If the database supports CREATE OR REPLACE VIEW, you can use that instead, and skip dropping the view.

For some databases, the right-click menu of a view has more actions, such as Rename View, or Refresh Materialized View for a materialized view.

What works as for tables

  • Viewing and editing data: the Data tab of a view works like the one of a table. See Viewing Table Data and Editing Table Data. Editing is only in DbVisualizer Pro, and whether you can change the data through a view depends on the database and the view.
  • Exporting: for most databases, right-click the view and select Export View. Exporting is only in DbVisualizer Pro. See Exporting a Table.
  • Viewing the DDL: select the DDL tab in the Object View tab of the view. The DDL tab is only in DbVisualizer Pro. See Viewing the Table DDL.
  • Generating SQL: for most databases, right-click one or more views and select Script View. Scripting several views at once is only in DbVisualizer Pro. See Generating SQL for a Table.
  • Filtering the tree: to show only some views in the Databases tab, which is only in DbVisualizer Pro, see Filtering Database Objects.