3 ms·
The 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 pare
by ebbv 14y ago
The 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 14y 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 14y 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 14y 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.