MySQL的SQL语句——常见报错


Eclipse连接MySQL数据库 — 8.0版jdbc驱动

键知识

https://blog.csdn.net/jenminzhang/article/details/9816853

【必应翻译】

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server ver
sion for the right syntax to use near 'there can be only one auto column and it must be defined as a key

只能有一个自动列,它必须定义为一个主键。

ERROR 1140 (42000): In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated
column 'mysql_shiyan.project.of_dpt'; this is incompatible with sql_mode=only_full_group_by

在没有 GROUP BY 的聚合查询中, SELECT 列表的表达式 #1 包含非聚合列 "mysql _ shiyan.project.of _ dpt";这与 sql _ mode = 仅 _ full _ group _ by

解决方法,改为 SELECT of_dpt,COUNT(proj_name) FROM project GROUP BY of_dpt; 也就是加上GROUP BY

GROUP BY 列X 就像是指定列X为组长,把组长作为计算的中心

查询时间时报错异常 FeatureNotSupport,解决方案任选:

  • MyBatis直接使用LocalDateTime时间类型以及MySQL时区问题排错
  • [解决]mybatis-plus使用jdk8的LocalDateTime 查询时报错 :
  •  LocalDatetime 与 mybatis、json的坑
SQL