Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialorange sky
Front End Web Development Techdegree Student 4,945 PointsInner join
Hello,
When you join 2 tables like the below, after ON do you always have to the name of a table dot the primary key equal to the name of the other table dot foreign key?
SELECT * FROM make INNER JOIN Model ON make.MakeID = Model.MakeID ;
2 Answers
chestopher collins
1,086 PointsThe only time I think its acceptable but NOT "Good Practice" is if the column name was unique, other wise putting the dot after the table specifies which column you want to join.
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 PointsI don't quite understand the question ...
Yes I think you always have to write condition on which you join tables.
How do you think SQL can infer which columns are equal ?
SQL cannot just know which columns to compare ...