Reputation: 21
When I am creating a table in H2 database, as following:
CREATE TABLE data2 (end_lat DOUBLE, end_lng DOUBLE, member_casual CHAR(7) unique,
month INTEGER, week INTEGER, day INTEGER, Year INTEGER,
day_of_week CHAR(10), tod TIME, ride_length INTEGER);
Then I am getting the error as below,
Syntax error in SQL statement "CREATE TABLE data2 (end_lat DOUBLE, end_lng DOUBLE, member_casual CHAR(7) unique, \000d\000a\0009\0009\0009\0009\0009[*]month INTEGER, week INTEGER, day INTEGER, Year INTEGER,\000d\000a\0009\0009\0009\0009\0009day_of_week CHAR(10), tod TIME, ride_length INTEGER)"; expected "identifier"; SQL statement:
CREATE TABLE data2 (end_lat DOUBLE, end_lng DOUBLE, member_casual CHAR(7) unique,
month INTEGER, week INTEGER, day INTEGER, Year INTEGER,
day_of_week CHAR(10), tod TIME, ride_length INTEGER) [42001-214] 42001/42001 (Help)
When I tried to create a table as following,
CREATE TABLE data2 (end_lat DOUBLE, end_lng DOUBLE, member_casual CHAR(7) unique,
month INTEGER, week INTEGER, day INTEGER, Year INTEGER,
day_of_week CHAR(10), tod TIME, ride_length INTEGER);
I was expecting it to create a table as it worked for me when I tried it in MySQL.
Appreciate it, if anyone can help me resolve this.
Upvotes: 1
Views: 1626
Reputation: 21
Answering to my own question
After changing the names of the column definition's to the following:
CREATE TABLE data2 (end_lat DOUBLE, end_lng DOUBLE, member_casual CHAR(7) not null unique, month_is INTEGER, week_is INT, day_is INTEGER, year_is INTEGER, day_of_week CHAR(10), tod TIME, ride_length INTEGER);
It Helped me resolve the error.
Upvotes: 1