I appreciate the feedback, no offence taken. I'm an analyst so I often find the leading comma useful when I'm testing something and want to quickly comment a column out but I take your point.
And I agree, I should have used CTEs for this query, I was just trying to save lines of code which had the unintended consequence of quite an ugly query. However I did want to use it as an example of indentation being useful to make it slightly easier to read. Although perhaps I'm the only one who thinks so.
I greatly appreciate the constructive criticism.
Re:SQL Tips and Tricks
by password4321 on Thursday September 26, 2024 @12:40AM
(#41654613)
> testing something and want to quickly comment a column out
This is a pretty solid reason for use in temporary queries so no doubt this approach will be around for a long time.
Re:SQL Tips and Tricks
by otteromkram on Wednesday September 25, 2024 @09:17PM
(#41653549)
I love leading commas and am leading the charge for change.
I apologize in advance and hope you are able to come to grips with how easy it is to read and understand at some point in the near future.
On point 3: What I do is use CTEs to create intermediate columns (with good names) and then a final one creating the final column. It's way more readable.
```sql
with intermediate as (
select
from timeslot_data)select
from intermediate ```