Reputation: 21
CREATE TABLE sars.test (
Date date,
Country text PRIMARY KEY,
Cumulative number of case(s) int,
Number of deaths int,
Number recovered int);
The error was:
SyntaxException: line 1:79 mismatched input 'of' expecting ')'
(... PRIMARY KEY, Cumulative number [of]...)
Upvotes: 2
Views: 88
Reputation: 57798
Column names in Cassandra cannot contain spaces, or parens. You'll probably want to use something like an underscore for the spaces, and get rid of the parens. This works for me:
CREATE TABLE sars.test (
Date date,
Country text PRIMARY KEY,
Cumulative_number_of_cases int,
Number_of_deaths int,
Number_recovered int);
Also, remember that PRIMARY KEYs in Cassandra are unique. I add this note because I'm wondering how date
will be used here. If you're trying to track each country's totals as they change by date
, then you should add it to your PRIMARY KEY as a clustering key, like this:
CREATE TABLE sars.test (
Date date,
Country text,
Cumulative_number_of_cases int,
Number_of_deaths int,
Number_recovered int,
PRIMARY KEY (country,date));
Upvotes: 1