在分组中使用列名或者列号,但不要混合使用
-- Good
select user_id, count(*) as total_charges
from charges
group by user_id
-- Good
select user_id, count(*) as total_charges
from charges
group by 1
-- Bad
select
    timestamp_trunc(created_at, month) as signup_month,
    vertical,
    count(*) as users_count
from users
group by 1, vertical 
           SQL 代码规范
SQL 代码规范 
        
         
             
             关于 LearnKu
                关于 LearnKu
               
                     
                     
                     粤公网安备 44030502004330号
 粤公网安备 44030502004330号