DROP TYPE

Synopsis

The DROP TYPE statement removes an existing user-defined data type.

Syntax

Diagram

DROP TYPE - 图1

Grammar

  1. drop_type ::= DROP TYPE [ IF EXISTS ] type_name;

Where

  • type_name is an identifier (possibly qualified with a keyspace name).

Semantics

  • An error is raised if the specified type_name does not exist unless IF EXISTS option is used.
  • A user-defined type_name cannot be dropped if it is currently used in a table or another type.

Examples

  1. cqlsh:example> CREATE TYPE person(first_name TEXT, last_name TEXT, email TEXT);
  1. cqlsh:example> DROP TYPE person;

See also