Skip to main content
Version: Nightly

REMOVE

REMOVE statement

The REMOVE statement is used to remove resources such as databases, tables, indexes, events and more. Similar to an SQL DROP statement.

Statement syntax

SurrealQL Syntax
REMOVE [
NAMESPACE @name
| DATABASE @name
| USER @name ON [ ROOT | NAMESPACE | DATABASE ]
| TOKEN @name ON [ NAMESPACE | DATABASE ]
| EVENT @name ON [ TABLE ] @table
| FIELD @name ON [ TABLE ] @table
| INDEX @name ON [ TABLE ] @table
| ANALYZER @name
| FUNCTION fn::@name
| PARAM $@name
| SCOPE @name
| TABLE @name
]

Example usage

Basic usage

The following queries show an example of how to remove resources

REMOVE NAMESPACE surrealdb;

REMOVE DATABASE blog;

REMOVE USER writer ON NAMESPACE;

REMOVE USER writer ON DATABASE;

REMOVE TOKEN writer_token ON NAMESPACE;

REMOVE EVENT new_post ON TABLE article;

-- Only works for Schemaful tables (i.e. tables with a schema)
REMOVE FIELD tags ON TABLE article;

REMOVE INDEX authors ON TABLE article;

REMOVE ANALYZER example_ascii;

REMOVE FUNCTION fn::update_author;

REMOVE PARAM $author;

REMOVE SCOPE documentation;

REMOVE TABLE article;