4 ms·
Why is "after the element" the proper place for a comma?
by hdctambien 13y ago
Why is "after the element" the proper place for a comma?
- noblethrasher 13y agoIt's probably more pleasent and easier to read for the next person.
- rtfeldman 13y agoThat's where it goes in English.
- jkeel 13y agoThat's what I was wondering. The comma is just a separator. Plus it's only really needed BEFORE each field not after the preceding field.
- hdctambien 13y ago(I can't reply to my reply) Comma first seems more consistent to me.... unless you write your WHERE clauses like this: WHERE a=b AND a=d AND e=f
- ebbv 13y agoThe same reason that you should put spaces before and after your logical operators. The same reason you should use consistent spacing on the left and right parenthesis. The same reason you should use caps for the SQL and lower case for all table and field names. Because it makes your SQL more legible. In english, commas go after the previous word, not before the next word. The syntax is the same for all programming languages. The fact that most compilers and interpreters don't require it is not an excuse for abusing it.
- cptskippy 13y agoI disagree with you regarding legibility. I've been using commas like this in SQL for 10 years and I find it to be much more legible and functional this way. Besides the subjective argument of legibility, what other benefits does it have? Having a comma preceding something is an indicator that it is one of many. When debugging you can easily comment out the column, or table from a query.
- ebbv 13y agoAgain, you can comment out lines with the normal syntax too. There's no reason for this gimmick syntax. In theory it makes the last 2 elements easier to deal with but it makes the first two harder. It's silly, and it's ugly.
- dennisgorelik 13y agoLowercase for table names? I think table names should be in PascalCase. And I personally prefer the rest of SQL to be in lowercase, so it does not attract too much attention. Usually in SQL table names and column names is the most important information.