//有谁能告诉我这个MySQL查询语法有什么问题吗?

String createTableSQL = ""
                + " CREATE TABLE location("
                + " location_id INTEGER PRIMARY KEY AUTOINCREMENT,"
                + " location_name VARCHAR(30),"
                + " addr VARCHAR(30),"
                + ")";

最佳答案

删除自动增量中的最后一个更改自动增量并添加主键(location_id

 String createTableSQL = ""
            + " CREATE TABLE location("
            + " location_id INTEGER PRIMARY KEY AUTO_INCREMENT,"
            + " location_name VARCHAR(30),"
            + " addr VARCHAR(30),"
            + " PRIMARY KEY (`location_id `))";

关于mysql - MySQL表创建查询语法错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39130856/

10-16 11:06