Skip to main content
Skip table of contents

Views

Views allow the user to create a simpler version of a given SQL statement.

It is a logical table based on one table. A view contains no data by itself.

For example, you can change the names of the selected columns or the order of the columns.

You can also filter the result of a select SQL statement on a table.

Command

CREATE VIEW

SQL
CREATE VIEW my_view (new_name1, new_name2) 
as SELECT column1, column3 FROM my_table

This will create a View named "my_view" with 2 columns: new_name_1 and new_name_2. These columns are based on the columns column1 and column3 of the table default.my_table.

Usage

From our example above, let's say that the table default.my_table is a 5 columns Fact table as follows:

column1column2column3column4column5
BIGINTINTSTRINGSTRINGDATE

The View named "my_view" that we created will be a logical table (there is no real data in that table) that looks like:

new_name1new_name2
BIGINTSTRING

You can then make queries such as

SELECT FROM VIEW

SQL
SELECT * FROM my_view

This will returns all the data from the columns column1 and column3 of my_table.

More

You can learn more about the CREATE VIEW commands here

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.