Thursday 5 March 2020

Cassandra: Drop user defined type

‘DROP TYPE’ keyword is used to drop user defined type.

Syntax:
<drop-type-stmt> ::= DROP TYPE ( IF EXISTS )? <typename>

Example
DROP TYPE address;

cqlsh> CREATE TYPE cassandratutorial.address (
   ... street_name text,
   ...     street_number int,
   ...     city text,
   ...     state text,
   ...     country text,
   ...     zip int
   ... );
cqlsh> 
cqlsh> DESCRIBE TYPE cassandratutorial.address;

CREATE TYPE cassandratutorial.address (
    street_name text,
    street_number int,
    city text,
    state text,
    country text,
    zip int
);
cqlsh> 
cqlsh> DROP TYPE cassandratutorial.address;
cqlsh> 
cqlsh> DESCRIBE cassandratutorial.address;

'address' not found in keyspace 'cassandratutorial'


Previous                                                    Next                                                    Home

No comments:

Post a Comment