Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I know there is a difference between INNER JOIN and FULL OUTER JOIN, I can see it, but, what is the difference between the two following: JOIN ... ON... and INNER JOIN...ON... and still yet JOIN...ON... vs FULL OUTER JOIN...ON...

Reason being is I think maybe just using JOIN is messing up a query I am working on that is posted on SO, link to question HERE.

So basically what is the syntactical difference between the actual set operations themselves?

Thank You,

share|improve this question
1  
"Cross posting" is posting the same question in different forums. Posting a link is ok and desirable. –  choroba Jul 25 '13 at 12:04
    
Ok, I'll post a link to the question, my code is return many many duplicates and it's driving me nuts...I have'nt even had my morning coffee yet lol –  MCP_infiltrator Jul 25 '13 at 12:16
2  
@MCP_infiltrator take a look at probably the best explanation out there: codinghorror.com/blog/2007/10/… –  mkk Jul 25 '13 at 12:35
    
@mkk awesome post thanks –  MCP_infiltrator Jul 25 '13 at 12:50
    
If the real problem is that your code is returning too many duplicates, you may want to ask another question where this is the main point. And you may want to post your code. When I've helped people with duplicate problems in the past, it's usually due to wrong join conditions, or occasionally due to poor mapping between the SQL data model and the relational data model. –  Walter Mitty Jul 30 '13 at 12:49

1 Answer 1

up vote 7 down vote accepted

JOIN and INNER JOIN are the same, the inner keyword is optional as all joins are considered to be inner joins unless otherwise specified. The difference between JOIN and FULL OUTER JOIN is the same as the difference between INNER JOIN and FULL OUTER JOIN.

An inner join will only return matched rows, if a row in table A matches many rows in table B the table A row will be repeated with each table B row and vice versa.

A full outer join will return everything an inner join does and return all unmatched rows from each table.

share|improve this answer
    
Thank you, I didn't know that JOIN and INNER JOIN were equivalent statements. –  MCP_infiltrator Jul 25 '13 at 12:32
1  
Best practice is to explicitly write INNER JOIN in order to avoid confusion. –  Neil Jul 25 '13 at 13:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.