mirror of
https://github.com/allankoechke/turso.git
synced 2026-12-01 01:27:37 +00:00
Comprehensive SQL reference at docs/sql-reference/ covering all supported statements, functions, expressions, PRAGMAs, and extensions. Includes mdBook-based local preview (./preview.sh). Turso-specific features (CDC, materialized views, custom types, MVCC, vector search, FTS, encryption) are integrated inline with callouts. Experimental features link to a dedicated page with enablement instructions for the CLI and all SDKs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
57 lines
1.3 KiB
Plaintext
57 lines
1.3 KiB
Plaintext
---
|
|
title: DROP VIEW
|
|
description: Remove a view from the database
|
|
sidebarTitle: DROP VIEW
|
|
---
|
|
|
|
# DROP VIEW
|
|
|
|
Remove a view definition from the database. The underlying tables and their data are not affected.
|
|
|
|
## Syntax
|
|
|
|
```sql
|
|
DROP VIEW [IF EXISTS] [schema-name.]view-name;
|
|
```
|
|
|
|
## Description
|
|
|
|
`DROP VIEW` removes a previously created view. After the view is dropped, queries referencing the view name produce an error. The tables referenced by the view are unaffected.
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Description |
|
|
|-----------|-------------|
|
|
| `IF EXISTS` | Prevents an error if the view does not exist. The statement is a no-op when the view is absent. |
|
|
| `schema-name` | The name of the attached database containing the view. Defaults to the main database if omitted. |
|
|
| `view-name` | The name of the view to drop. |
|
|
|
|
### Behavior
|
|
|
|
- Any triggers defined as INSTEAD OF on the dropped view are also removed.
|
|
- If the view is a materialized view, the stored data is also removed.
|
|
|
|
## Examples
|
|
|
|
### Drop a View
|
|
|
|
```sql
|
|
DROP VIEW active_users;
|
|
```
|
|
|
|
### Drop a View Only if It Exists
|
|
|
|
```sql
|
|
DROP VIEW IF EXISTS old_report;
|
|
```
|
|
|
|
### Drop a View in an Attached Database
|
|
|
|
```sql
|
|
DROP VIEW aux.cached_stats;
|
|
```
|
|
|
|
## See Also
|
|
|
|
- [CREATE VIEW](/docs/sql-reference/statements/create-view) for creating views and materialized views
|