Files
mindsdb--mindsdb/docs/mindsdb_sql/sql/create/view.mdx
2025-09-03 16:28:06 +02:00

28 lines
550 B
Plaintext

---
title: Create a View
sidebarTitle: Create a View
---
## Description
The `CREATE VIEW` statement creates a view, which is a great way to do data preparation in MindsDB. A VIEW is a saved `SELECT` statement, which is executed every time we call this view.
## Syntax
Here is the syntax:
```sql
CREATE VIEW [IF NOT EXISTS] project_name.view_name AS (
SELECT columns
FROM integration_name.table_name AS a
JOIN integration_name.table_name AS p ON a.id = p.id
JOIN ...
);
```
Here is how to list all views:
```sql
SHOW VIEWS;
```