刷题

9:11

  • GROUP BY 是把相同列值的行 划分到一个组
  • Cross join会将表a的每一项都和表b的每一项配对产生笛卡尔积
  • 如果要查询的项是一张没有构建的表的,那么就要嵌套查询并且给该表其名
    这是子查询
    from
    ( select Manager.Name as Name, count(reporter.Id) as cnt
    from Employee as Manager
    join Employee as reporter
    on Manager.Id = reporter.managerId
    group by Manager.id
    ) AS t

WITH CTE AS ()—也是子查询