For AI agents: the complete documentation index is available at /docs/llms.txt, the full documentation bundle is available at /docs/llms-full.txt, and this page is available as Markdown at /docs/interview/odps/sql/base.md.
  • 简体中文
  • 2026
  • 基础

    JOIN

    full outer join

    参考文档

    Group

    -- 过滤
    SELECT  user_id
            ,COUNT(1) AS order_cnt
    FROM    my_order
    WHERE   ds = '${bizdate}'
    GROUP BY user_id
    HAVING  order_cnt > 10
    LIMIT   100
    ;
    
    -- 数据上卷
    SELECT  ds_date
            ,CASE   WHEN GROUPING(status) = 1 THEN '合计'
                    ELSE status
            END AS status
            ,COUNT(*) AS cnt
    FROM    my_table
    GROUP BY 
    GROUPING SETS ((ds_date)
                  ,(ds_date,status))
    ;