从编程世界中学习英语系列(二)

本文解析了MySQL 5.7+版本中出现的“Expression#3 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘age’”错误。详细介绍了此错误的原因及如何避免该问题,特别是在启用了sql_mode=only_full_group_by的情况下。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错语句

Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘age’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

select列表中的第三列不存在于group by字句中,并且包含非聚合列’age’, 'age’并不依赖于group by字句中的列。

它和sql_mode=only_full_group_by不兼容。

原因解析

sql语句如下

select * from user where age>10 group by name

这条语句在<mysql5.7的版本中是允许的,会返回分组中的第一条数据。但在mysql5.7+中只允许查询group by

中的列以及使用聚合函数。

英文解析

  1. clause n. UK /klɔːz/ US /klɑːz/

    释义

    a particular part of a written legal document, for example a law passed by Parliament or a contract (= an agreement) 条款

    在计算机中的意思是从句

    例句

    Clause 4 of the constitution is thought to be the most important section

  2. aggregate n.UK /ˈæɡ.rɪ.ɡət/ US /ˈæɡ.rə.ɡət/ v or adj

    释义

    something formed by adding together severa amounts or things 集合体

    例句:

    They purchased an aggregate of 3,000 shares in the company

    派生词

    nonaggregated=non(否定前缀)+aggregated(adj.聚合的)

  3. compatible adj UK /kəmˈpæt.ə.bəl/ US /kəmˈpæt̬.ə.bəl/

    释义

    able to exist, live, or work successfully with something or someone else 共处,兼容

    例句

    This software may not be compatible with older operating systems.

    派生词

    incompatible=in(否定前缀)+compatible

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值