gpt4 book ai didi

mysql - 执行sql语法的正确语法是什么?

转载 作者:行者123 更新时间:2023-11-29 22:23:28 24 4
gpt4 key购买 nike

String ag ="ALTER TABLE QUESTION"+
"(ADD FOREIGN KEY (a_status) REFERENCES ANSWER(a_status))";

stmt.executeUpdate(ag);

Error message: 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 'FOREIGN KEY (a_status) REFERENCES ANSWER(a_status))' at line 1

最佳答案

这应该是正确的。请参阅offical documentation :

String ag ="ALTER TABLE QUESTION ADD FOREIGN KEY (a_status) REFERENCES ANSWER(a_status)";

关于mysql - 执行sql语法的正确语法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30498815/

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