1

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.

1
  • Remove excess CR/LF/TAB characters before day_of_week column definition. Commented Nov 3, 2022 at 6:11

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Yes. Or CREATE TABLE data2 ( end_lat DOUBLE PRECISION, end_lng DOUBLE PRECISION, member_casual CHAR(7), "month" INTEGER, week INTEGER, "day" INTEGER, "year" INTEGER, day_of_week CHAR(10), tod TIME, ride_length INTEGER);
So what was the error?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.