Skip to main content
Version: current [26.x]

CREATE VIEW

Create or replace a view.

CREATE VIEW will parse and validate the SQL but does not fully plan the query or re-validate access control for any nested views. Full query planning and access control are only performed when the view is queried. If the view requires schema learning, the schema might be outdated at creation time but it will automatically update the first time the view is queried through the Dremio console.

Syntax
CREATE [ OR REPLACE ] VIEW <view_name> AS
<select_statement> FROM <table_name>

Parameters

OR REPLACE String   Optional

If specified, any table/view with the same name will be replaced. This is primarily used to create new tables/views with security policies applied for restricted access. You cannot specify this parameter with the IF NOT EXISTS qualifier.


<view_name> String

The path of the view that you want to create. The name of the view should be unique and cannot include the following special characters: /, :, [, or ].


<select_statement> String

The query used to populate the view.

note

If the query refers to a table in a remote catalog, then that table must be fully qualified with an AT specification. For example:

CREATE VIEW StudentCatalog.first quarter
AS SELECT * FROM StudentCatalog.studentName
JOIN EnrollmentCatalog.sourceName AT BRANCH firstQuarter
ON TRUE

<table_name> String

The name of the object. Object names within a project must be unique, cannot conflict with system-defined objects, and are case-insensitive.

Examples

Create a view
CREATE VIEW demo.jobs_view as SELECT * FROM "oracle_e2e".DREMIO.JOBS
Replace a view
CREATE OR REPLACE VIEW demo.jobs_view as SELECT * FROM "oracle_e2e".DREMIO.JOBS