Cassandra操作

CQL 数据库操作

创建数据库 keyspace

CREATE KEYSPACE interview WITH REPLICATION = { 'class' : 'org.apache.cassandra.locator.NetworkTopologyStrategy', 'HZ': '2', 'SZ': '2' } AND DURABLE_WRITES = true;

创建表

CREATE TABLE IF NOT EXISTS interview.member_interview_detail(
    interview_id uuid,
    question_num int,
    question_description text,
    video_path text,
    video_name text,
    audio_path text,
    audio_name text,
    video_length int,
    PRIMARY KEY (interview_id,question_num)
);

建立索引

CREATE INDEX idx_teacher_age on teacher(age);
CREATE INDEX member_interviews_interview_db_id on interview.member_interviews(interview_db_id);

添加字段

alter table interview.interview add interview_members int;
alter table interview.interview add interview_price float;

参考:博客地址

猜你喜欢

转载自blog.csdn.net/xiaopeng_han123/article/details/78739354