Working with Views

Last modified: November 2, 2023

View is a logical table based on one or more tables or views. A view contains no data itself, but retrieves it from underlying tables and views when requested. Views are introduced in MySQL 5.0.1.

dbForge Studio allows you to create, modify, and drop views, retrieve and alter data in underlying tables.

Creating a View

1. Click the Create New Database Object button and specify type View in the dialog.

2. Input name of the view.

3. Click Create and, if specified name is unique, the document of this view will appear. Note that views share the same namespace with tables.

4. Type a query that will represent the view. You do not have to type CREATE OR REPLACE VIEW … AS because dbForge Studio adds this clause for you.

5. Optionally, alter the name or change database (owner) in which the new view will be created.

6. Save the document. If there are any errors in the SQL syntax, you will be notified about it.

-or-

1. In Database Explorer, right-click the Views node and select New View.

2. Input name of the view and type a query that will represent the view. You do not have to type CREATE OR REPLACE VIEW … AS because dbForge Studio adds this clause for you.

3. Optionally, alter the name or change database (owner) in which the new view will be created.

4. Save the document. If there are any errors in the SQL syntax, you will be notified about it.

Editing a View

Edit a view by selecting Edit View on the Database Explorer node shortcut menu. In the opened document, you can alter the query text. Once a view is created, you can not modify its name or owner. Save the document to apply changes you’ve made to the query text.

Dropping a View

Drop a view by selecting Delete on the Database Explorer node shortcut menu.

Retrieving and Modifying View Data

To retrieve view data, right-click the view in Database Explorer and choose Select All Rows on the shortcut menu. The data is rendered in grid-based editor. You can browse and edit view data in the same way as you browse and edit table data.

Note

Some views can be non-updatable. You can not edit their data.