Drop Column from Table in Cassandra
Cassandra let you drop the column from table if you would like to do that. You can not drop the column which is part of Primary key. If you will try to drop column which is part of primary key, you will get below error.
InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot drop PRIMARY KEY part columnName"
Syntax:
Example:
Let's create Employee table by using below script.
(
employeeid UUID PRIMARY KEY,
fname TEXT,
lname TEXT,
address TEXT,
age TINYINT
);
If we would like to drop the age column, we can use below script.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.