Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MySQL中函数的执行顺序_Mysql_Sql Execution Plan_Sql Function_Order Of Execution - Fatal编程技术网

MySQL中函数的执行顺序

MySQL中函数的执行顺序,mysql,sql-execution-plan,sql-function,order-of-execution,Mysql,Sql Execution Plan,Sql Function,Order Of Execution,我知道MySQL的执行顺序不是固定的。但是,我听说通常是这样的: 来自,包括加入s 其中 分组依据 具有 选择 DISTINCT 订购人 限制和偏移 但是,如果我运行像COUNT()这样的函数(比如下面的代码),它什么时候开始执行?MySQL如何决定将使用该函数计算的主题(例如,计算什么count()function)?我对MySQL中的AVG()、SUM()、MAX()等函数的执行顺序和目标指定感到困惑 SELECT productvendor, count(*) FROM products

我知道MySQL的执行顺序不是固定的。但是,我听说通常是这样的:

  • 来自
    ,包括加入s
  • 其中
  • 分组依据
  • 具有
  • 选择
  • DISTINCT
  • 订购人
  • 限制
    偏移
  • 但是,如果我运行像
    COUNT()
    这样的函数(比如下面的代码),它什么时候开始执行?MySQL如何决定将使用该函数计算的主题(例如,计算什么
    count()
    function)?我对MySQL中的
    AVG()
    SUM()
    MAX()
    等函数的执行顺序和目标指定感到困惑

    SELECT productvendor, count(*)
    FROM products
    GROUP BY productvendor
    HAVING count(*) >= 9;
    

    您的顺序不正确
    选择在分组依据之前

    FROM, including JOINs
    WHERE
    SELECT the row  obtained  by from and where in a temporary area for others 
            operation (and build the column alias)
    DISTINCT
    GROUP BY
    HAVING
    ORDER BY
    LIMIT and OFFSET
    return the final result 
    

    使用select列对临时结果执行count和AGEGATION函数。。此操作通过让序列不正确来过滤结果 选择在分组依据之前

    FROM, including JOINs
    WHERE
    SELECT the row  obtained  by from and where in a temporary area for others 
            operation (and build the column alias)
    DISTINCT
    GROUP BY
    HAVING
    ORDER BY
    LIMIT and OFFSET
    return the final result 
    

    使用select列对临时结果执行count和AGEGATION函数。。这个操作产生的结果是通过使用

    进行过滤,这很重要吗?这很重要吗?谢谢你的回答,但我不知道为什么,但是这里的许多博客帖子说,
    SELECT
    是在
    groupby
    之后更新的。。有一些建议。。如果选择是在“分组人”之后执行的,那么“分组人”怎么可能使用别名呢?谢谢你的回答,但我不知道为什么,但这里的许多博客帖子都说,
    select
    是在
    groupby
    之后执行的,我很困惑答案更新了。。有一些建议。。如果选择是在group by之后执行的…该group by如何可能使用别名?