gpt4 book ai didi

java - SQL 语句 SQLSyntaxErrorException

转载 作者:行者123 更新时间:2023-11-30 04:25:10 26 4
gpt4 key购买 nike

我在执行以下 SQL 语句时遇到错误:

String sql = "CREATE TABLE RESERVATION (";
sql = sql + " UID VARCHAR,";
sql = sql + " ISBN INTEGER,";
sql = sql + " DATEISSUE DATE,";
sql = sql + " DATERETURN DATE,";
sql = sql + " FOREIGN KEY (UID) REFERENCES USERS (UID),";
sql = sql + " FOREIGN KEY (ISBN) REFERENCES BOOKS (ISBN) )";

这是我收到的错误:

java.sql.SQLSyntaxErrorException: Syntax error: Encountered "," at line 1, column 39.

最佳答案

第 39 列接近 varchar 的末尾,因此您可能需要它的大小,例如 varchar(20)

关于java - SQL 语句 SQLSyntaxErrorException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16093076/

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