我创建了一个表,university\u by \u person,如下所示:
CREATE TABLE university_by_person (
person_name frozen<name>,
university_id uuid,
university_name text,
university_phone text,
university_address frozen<address>,
PRIMARY KEY ((person_name), university_id)
) WITH CLUSTERING ORDER BY (university_id ASC)
AND comment = 'Q1. Find universities(including university info) near a person';
我还自定义了类型名称和地址,如下所示:
CREATE TYPE name (
first_name text,
last_name text
)
CREATE TYPE address (
street text,
city text,
state_or_province text,
postal_code text,
country text
)
但是,现在当我尝试将一条记录插入这个表并按enter键时,cmd提示符只返回“…”。看来指挥官认为我的命令还没完成?但我有一个“;”最后。我怎么能把它修好?
我的插入命令:
INSERT INTO university_by_person
(person_name, university_id, university_name, university_phone, university_address)
VALUES (
{first_name: 'Meryl', last_name: 'Streep'},
e7ae5cf3-d358-4d99-b900-85902fda9bb0,
'University of Toronto',
'416-963-0086',
{street: '27 King's College Cir', city: 'Toronto', state_or_province: 'Ontario', postal_code: 'M5S 1A1', country: 'Canada'}
);
1条答案
按热度按时间ohfgkhjo1#
问题是
street
地址中有一个包含单引号的字符串('
)人物:这个
...
cqlsh中的一行表示它需要更多的输入,因为字符串过早地被“终止”。要在字符串中使用撇号,需要用另一个单引号转义,使其看起来像:
以下是完整更正的cql声明:
应该按预期执行。该列的值还应包括撇号:
有关详细信息和注解,请参见转义字符。干杯!