数据库报错类型及解决方法

错误类型1

ERROR 1064 (42000): 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 'desc varchar(32))_' at line 4

解决方法:

错误类型2

ERROR 1215 (HY000): Cannot add foreign key constraint

错误原因:

之所以出现1215的问题,是由于主外键之间的数据类型不一致造成的   或者是主外键字段名不同导致的

错误类型3----千万注意这个问题!!!!

ERROR 1072 (42000): Key column 'techer_id' doesn't exist in table

错误原因:

字段名写错了!!!!!!

错误类型4

mysql> select id,name, age from emp where max(salary);
ERROR 1111 (HY000): Invalid use of group function

错误原因:

聚合函数 max min count sum avg  等必须放在 group by 分组之后!!!!

原文地址:https://www.cnblogs.com/qinsungui921112/p/11383717.html