So I have an AWS RDS instance with a MySQL 5.6.37 engine, and I'm checking the syntax of my code on sqlfiddle.com with mySQL version 5.6.
The code I put in sqlfiddle is
CREATE TABLE Teacher_Times(
TEACHER_ID TEXT,
BEG_TIME TIME,
END_TIME TIME,
DAYS VARCHAR(9) DEFAULT "MTWRF",
TYPE VARCHAR(11) DEFAULT "unavailable");
The code I have that connects to the rds is using jdbc configured very similarly to this guy's stack overflow post: Not able to set spring.datasource.type
In my code I have
result =
"CREATE TABLE Teacher_Times(\n" +
" TEACHER_ID TEXT,\n" +
" BEG_TIME TIME,\n" +
" END_TIME TIME,\n" +
" DAYS VARCHAR(9) DEFAULT \"MTWRF\",\n" +
" TYPE VARCHAR(11) DEFAULT \"unavailable\");";
jdbc_t.execute(result);
result = "";
This general format for making queries has works in a bunch of other places, and I don't know if the AWS stuff is even relevant.
The exact error is "com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"MTWRF"' at line 5"