4 ms·
In the second example, I find it depends on the language. In general I prefer the top version, but in SQL and some other languages I will usually use the second
by niccl 16y ago
In the second example, I find it depends on the language. In general I prefer the top version, but in SQL and some other languages I will usually use the second. That's because I might well want to comment out part of the statement. For example:
select
col_1
-- , col_2
, col_3
from
the_table
;
With this approach (the OP's second approach), I can easily comment out a whole line and the rest of the statement will be syntactically correct. The alternative means having to chase around to find the trailing comma (or 'and', or whatever).
But maybe it really only matters because of my recent 'suck it and see' approach to SQL, where I've been exploring an unknown database, trying to find the queries that work...