SELECT * FROM facts INNER JOIN cities ON cities.facts_id = facts.id LIMIT 10;
What I expected to happen:
Okay, so this question is less about what I expected to happen and more about differences in syntax for different situations. I completed the SQL Fundamentals course and I saw that the syntax for joining 2 tables, each with an identical column name, was as below:
JOIN table2 ON table1.matchingcolumn = table 2.matchingcolumn;
Now, in this lesson, the column names are different but the data is basically the same, i.e. facts.id is the same data as cities.facts_id . Right? But I notice the syntax is the same as above except on the JOIN clause, it goes
JOIN table2 ON table2.column_name2 = table1.column_name1;
Would I be correct to explain to myself, as a matter of practice, that this syntax is different because the column names the 2 tables are being joined on do NOT share the same name? Or is there a different reason?