JAVA&MySQL不需要的额外列
因此,基本上我创建了一个数据库,其中包含一个表(仅用于测试目的),有2个元素(第一个VARCHAR(255)和age INTEGER),如下所示:
protected void createTableExamPeriod() throws SQLException {
//STEP 4: Execute a query
System.out.println("Creating table in given database...");
stmt = conn.createStatement();
String drop = "DROP TABLE IF EXISTS REGISTRATION ";
String table = "CREATE TABLE IF NOT EXISTS REGISTRATION " +
" (first VARCHAR(255), " +
" age INTEGER )";
stmt.executeUpdate(drop);
stmt.executeUpdate(table);
populateExamPeriodTable();
System.out.println("Created table in given database...");
}
所以我的问题是,我如何摆脱这个额外的列,因为现在,我不能在其中插入“正确”数量的参数,因为这个额外的列,当我这样做时:
protected void populateExamPeriodTable() throws SQLException {
Statement stmt = conn.createStatement();
String insertSql = "INSERT REGISTRATION VALUES(3 + 2 + 5)";
stmt.executeUpdate(insertSql);
}
# 1 楼答案
New
不是新列PHPMyAdmin
显示它以图形方式添加新列