> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.firebolt.io/feedback

```json
{
  "path": "/reference-sql/commands/data-definition/create-view",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

> Reference and syntax for the CREATE VIEW command.

# CREATE VIEW

Creates a view, which is useful to filter, focus, and simplify a data set for querying. Views provide a level of abstraction that can make subqueries easier to write, especially for commonly referenced subsets of data.

View results are not stored for future usage. Each time a query references a view, the view runs its `SELECT` query. For this reason, views do not provide a performance advantage. Consider using a materialized common table expression (CTE) as an alternative. For more information, see [Materialized common table expressions](/reference-sql/commands/queries/select#materialized-common-table-expressions).

The optional `IF NOT EXISTS` and `OR REPLACE` clauses are mutually exclusive. They specify behavior if a view with the same name already exists. If neither clause is specified, an error occurs if a view with the same `<view_name>` already exists.

## Syntax

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
CREATE VIEW [IF NOT EXISTS] <view_name> [(<column_list>)]
AS SELECT <select_statement>
```

**—OR—**

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
CREATE [OR REPLACE] VIEW <view_name> [(<column_list>)]
AS SELECT <select_statement>
```

## Parameters

| Parameter            | Description                                                                                                                                                                                                                                                              |
| :------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `IF NOT EXISTS`      | Specifies that an existing view with `<view_name>` will not be replaced with this view definition. This is the default behavior, but this clause suppresses the error message that would otherwise occur, which is useful for scripted and programmatic implementations. |
| `OR REPLACE`         | Specifies that an existing view with `<view_name>` will be replaced with this view definition.                                                                                                                                                                           |
| `<view_name>`        | An identifier that specifies the name of the view. This name must be unique within the database.                                                                                                                                                                         |
| `<column_list>`      | An optional list of column names to be used for columns of the view. If not specified, the column names are deduced from the query.                                                                                                                                      |
| `<select_statement>` | The select statement for creating the view.                                                                                                                                                                                                                              |

## Examples

### Filtering a table

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
CREATE VIEW fob_shipments
AS SELECT   l_shipmode,
            l_shipdate,
            l_linestatus,
            l_orderkey,
FROM    lineitem
WHERE   l_shipdate > 1990-01-01
AND     l_shipmode = 'FOB';
```

### Wrapping an Iceberg table

You can wrap a [`READ_ICEBERG`](/reference-sql/functions-reference/iceberg/read_iceberg) TVF call in a view for easier querying of Iceberg tables:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
CREATE VIEW lineitem AS SELECT * FROM READ_ICEBERG(
    URL => 's3://firebolt-core-us-east-1/test_data/tpch/iceberg/tpch.db/lineitem'
  );

SELECT l_shipmode, l_extendedprice
FROM lineitem
WHERE l_shipdate > '1995-01-01'
LIMIT 10;
```

For a complete guide, see [Simplifying queries with views](/reference-sql/functions-reference/iceberg/read_iceberg#simplifying-queries-with-views).
