数据库
首页 > 数据库> > 解决SQLSyntaxErrorException: Incorrect table definition; there can be only one auto column and it must

解决SQLSyntaxErrorException: Incorrect table definition; there can be only one auto column and it must

作者:互联网

问题描述

mysql数据库使用sql建表语句新建一张表,并还有自增的列

Caused by: java.sql.SQLSyntaxErrorException: Incorrect table definition; there can be only one auto column and it must be defined as a key

问题分析

java.sql。SQLSyntaxErrorException:表定义不正确;只能有一个自动列,必须将其定义为键

有自动增长的列,但是该列没有设置主键;

解决方案

  在创建表的SQL中,添加PRIMARY KEY (`LOG_NR_`)

 

标签:Incorrect,definition,java,SQLSyntaxErrorException,defined,sql,table
来源: https://www.cnblogs.com/lpan1024/p/16694841.html