我的类型:
CREATE TYPE author(
firstname text,
lastname text
);
我的表:
CREATE TABLE ksiazki(
publishing text,
origin text,
id int,
title text,
author map<text, frozen<author>>,
categories set<text>,
pages int,
PRIMARY KEY ((publishing,origin), id, title)
);
答案 0 :(得分:0)
您无法更新或删除冻结作者的名字或姓氏。您必须更新或删除整个作者值
您可以使用插入数据。
INSERT INTO ksiazki (publishing , origin , id , title , author ) VALUES ( 'pub', 'orig', 1, 'Title', {'author 1' : {firstname:'MD', lastname : 'Test'}}) ;
如果您想更改“作者1”名称,请使用此查询进行更新:
UPDATE ksiazki SET author = author + {'author 1' : {firstname:'Ashraful', lastname : 'Islam'}} where publishing = 'pub' and origin = 'orig' and id = 1 and title = 'Title';
如果您想添加其他作者'author 2',请使用此查询:
UPDATE ksiazki SET author = author + {'author 2' : {firstname:'Ashraful', lastname : 'Alom'}} where publishing = 'pub' and origin = 'orig' and id = 1 and title = 'Title';
如果要删除“作者2”,请使用以下查询:
DELETE author['author 2'] FROM ksiazki where publishing = 'pub' and origin = 'orig' and id = 1 and title = 'Title';