gpt4 book ai didi

mySQL建表查询语法错误

转载 作者:行者123 更新时间:2023-11-28 23:26:31 25 4
gpt4 key购买 nike

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

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

最佳答案

去掉AUTO_INCREMENT中的最后一个变化AUTOINCREMENT并添加PRIMARY KEY(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建表查询语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39130856/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com