What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

In old releases inner joins where coded like this

Select * from table_a, table_b 
where table_a.some_column = table_b.some_column 
and ... (further conditions)

Using ansi standard joins you can rewrite this as

Select * 
from table_a 
  inner join table_b on table_a.some_column = table_b.some_column 
where ... (further conditions)

The advantage is, that the reader is told which columns are used for the join and has not to solve the puzzle which conditions describe the join and which describe the where condition.

What about downvoting all answers using old style inner joins until they are rewritten in ANSI style ?

Not intended as punishment, but as community pressure to enforce the improved coding style?

Edit:

Can you give me hints, which of the following items caused the downvoting of my question

  • wanting to enforce some kind of sql syntax in the answers of SO
  • the proposal to use downvotes to achieve this
share|improve this question
    
Why don't you just edit them? –  uɐɯsO uɐɥʇɐN Jan 1 '11 at 18:43
    
@George: Because he doesn't have the rep, obviously. Far easier to ask other people to do one's dirty work than to put in the time and effort to do it oneself. –  Aarobot Jan 1 '11 at 18:50
    
To your edit, I didn't downvote so I'm just guessing, but I think it's probably a little of both. Downvoting to enforce a particular coding style seems a little heavy handed. Answers in the old style can still be helpful. You're certainly welcome to spend your own downvotes as you see fit, but I'm not crazy about encouraging others to vote one way or the other en masse to enforce what amounts to a personal preference. –  Bill the Lizard Jan 2 '11 at 3:37
    
I get somewhat the impression, that besides warning users about SQL injection all best-practice advises seem to be seen as off topic here –  bernd_k Jan 2 '11 at 17:44

3 Answers 3

up vote 7 down vote accepted

Unfortunately, especially if the old syntax still worked, all that you'd do is attract more up-votes to the answer.

Why?

Well, people would see the down-vote on what to them looks like a perfectly valid answer and they'd be more likely to up-vote to counter your down-vote. Which would have the opposite effect to that which you intended.

Far better to provide your own answer, as Bill suggests, and perhaps comment on the original answer pointing out the new information.

share|improve this answer
    
Perhaps it is really the best way to copy and reformat a given answer without qualms, but a clear hint, that it is a rewrite and giving the original answerer the opportunity to improve his answer and leaving it up to the community to vote for the best answers –  bernd_k Jan 1 '11 at 17:17
    
@bernd_k - if you do copy - just copy the code and add your own explanation. –  ChrisF Jan 1 '11 at 17:18

I'd be against downvoting the first code example you gave if it worked. It's still helpful. It's better to just provide your own answer with the new style join syntax and let the community (and OP) decide which they prefer with upvotes.

share|improve this answer
    
Using your locic, it would be correct to give answer like: select case when 1 < = 2 then 1 else 0 end, because Microsoft never fixed this eary Sybase bug. Have a lot of fun reviewing bad formatted code using old but valid syntax. –  bernd_k Jan 2 '11 at 17:41
    
@bernd_k: No, you still have to use a little bit of common sense. If you have none, then I recommend not asking/answering questions at all. –  Bill the Lizard Jan 2 '11 at 17:51

Actually, you're the one that's wrong here.

Both types of join follow the ANSI standard. The comma-separated syntax with conditions in the predicate is ANSI-89. The INNER JOIN syntax is ANSI-92. They are both "ANSI joins".

This bizarre but widespread belief that the ANSI-89 syntax is some sort of proprietary, obsolete or deprecated syntax seems to be the result of endless repetition by uninformed or misinformed people on the internet who refer to the ANSI-92 syntax as just "ANSI joins" and the ANSI-89 syntax as "old style" or something similar. It's simply not correct.

Portability concerns aside, an answer using the ANSI-89 syntax is still a correct answer. It's a minor semantic issue, such as using a subquery vs. a CTE. Of course in certain versions of certain DBMSes the ANSI-89 syntax may be deprecated or not supported, and if the question specifies such an environment then a comment or downvote would be warranted - but otherwise, stop being anal.

The only answers that anybody should be downvoting are those indicating (either explicitly or implicitly) that the ANSI-89 standard is not actually ANSI compliant.

share|improve this answer
    
@Aarbot Which syntax do you encourage users to write new sql queries? And do you like to review queries with lots of ANSI-89 style joins. –  bernd_k Jan 1 '11 at 19:57
3  
@bernd_k: I always answer questions and write my actual SQL queries using the ANSI-92 syntax. I don't "encourage" either one. And I don't like to review queries at all; ANSI-89 may be more error-prone (which is why they introduced a new syntax in ANSI-92) but that does not mean it actually has errors. –  Aarobot Jan 1 '11 at 20:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .