Documentation

SQL Manage Views

SQL Manage Views

The Views activity lists every view in the current database and lets you preview definitions, edit them in the SQL Editor, or drop them — all without leaving the workspace. A search box filters the list live, and an inline DDL preview means you can audit view bodies without opening a separate dialog.

Quick Start

  1. Open the Views activity from a database's context menu.
  2. Scan or search the list; the badge next to the title shows the total count.
  3. Click a view row to expand it and inspect the CREATE VIEW definition.
  4. Use the hover actions to Edit, Show DDL, or Drop.
  5. Click New in the toolbar to open the create-view flow in the SQL Editor.

Toolbar

  • Search — case-insensitive substring match against view names.
  • Refresh — reloads the list from the connected server.
  • New — starts a new view (opens the editor pre-filled with a CREATE VIEW skeleton).

The View List

Each row shows the view icon, the name, and a VIEW badge. Rows expose actions on hover:

ActionEffect
Edit Loads the view's definition into the SQL Editor as an ALTER VIEW / CREATE OR REPLACE VIEW template.
Show DDL Opens the DDL viewer with the full CREATE VIEW statement.
Drop Confirms, then issues DROP VIEW.

Additional interactions:

  • Click a row to expand or collapse the inline DDL preview.
  • Double-click to open the view as a browsable dataset in the SQL Table activity.
  • Right-click for a context menu with the same actions.

Inline DDL Preview

Expanding a row lazily loads the definition and renders it in a monospace block:

CREATE OR REPLACE VIEW active_users AS
SELECT u.id, u.email, u.created_at
FROM   users u
WHERE  u.deleted_at IS NULL
  AND  u.tenant_id = current_setting('app.tenant_id')::int;

If the driver cannot return the source (for example, encrypted views on SQL Server), the preview displays No definition available.

Creating a New View

The New button opens an editor tab with a starter template. Fill in the name and query, then execute:

CREATE VIEW monthly_revenue AS
SELECT date_trunc('month', paid_at) AS month,
       SUM(amount)                  AS revenue
FROM   payments
WHERE  status = 'paid'
GROUP  BY 1
ORDER  BY 1;

Dialect Notes

  • PostgreSQL supports CREATE OR REPLACE VIEW and materialized views (REFRESH MATERIALIZED VIEW).
  • MySQL / MariaDB supports ALGORITHM and SQL SECURITY clauses.
  • SQL Server requires ALTER VIEW for updates and does not allow ORDER BY without TOP.
  • SQLite has read-only views; use DROP VIEW + CREATE VIEW to modify.

Ready to try VisuaLeaf?

Download and start managing your MongoDB databases with ease.

Download Free Trial