sqlite - SQL GROUP BY usages -


i doing sql transformation lesson codecademy here. not sure why using numbers after group clause , numbers doing. can passed course kind let me know?

select dep_month,           dep_day_of_week,            dep_date,            count(*) flight_count       flights      group 1,2,3 

the numbers in group by clause refer columns in select list, left right. hence, query identical following:

select     dep_month,     dep_day_of_week,     dep_date,     count(*) flight_count flights group     dep_month,     dep_day_of_week,     dep_date 

the above query wrote use in practice. reason group 1,2,3 refers positions rather columns. if refactors select later, runs risk of breaking query.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -