CREATE TABLE "Test_KS_jonathan"."key" (
"id" int,
"name" text,
PRIMARY KEY("id")
)
GO
INSERT INTO "Test_KS_jonathan"."key"("id", "name")
VALUES(1, 'tariq')
GO
INSERT INTO "Test_KS_jonathan"."key"("id", "name")
VALUES(1, 'aqua')
GO
INSERT INTO "Test_KS_jonathan"."key"("id", "name")
VALUES(1, 'fold')
GO
select * from "Test_KS_jonathan"."key"
GO
Cassandra does not behave as other databases, if key exists already, it actually performs an UPDATE (as the result of your last SELECT statement).
Below is from Cassandra CQL/INSERT document:
"Description
An INSERT writes one or more columns to a record in a Cassandra table atomically and in isolation. No results are returned. You do not have to define all columns, except those that make up the key. Missing columns occupy no space on disk.
If the column exists, it is updated. You can qualify table names by keyspace. INSERT does not support counters, but UPDATE does."
Note the last sentence mentions that "INSERT does not support counters" which means you cannot apply INSERT to a column defined as a 'counter' data type.
Issue #9016 |
Closed |
Invalid |
Resolved |
Completion |
No due date |
No fixed build |
No time estimate |
Cassandra does not behave as other databases, if key exists already, it actually performs an UPDATE (as the result of your last SELECT statement).
Below is from Cassandra CQL/INSERT document:
"Description
An INSERT writes one or more columns to a record in a Cassandra table atomically and in isolation. No results are returned. You do not have to define all columns, except those that make up the key. Missing columns occupy no space on disk.
If the column exists, it is updated. You can qualify table names by keyspace. INSERT does not support counters, but UPDATE does."
Note the last sentence mentions that "INSERT does not support counters" which means you cannot apply INSERT to a column defined as a 'counter' data type.