I would like to know what is the best way to create a connection between two tables (or more). I have seen two different ways to do so.
In the next example, I have 2 tables. Table1 has customerId (key) and customerName. Table2 has customerId (key) and CustomerPhone
table1:
customerId | customerName|
============+=============+
1 | Josh |
2 | Nadia |
table2:
customerId | customerPhone|
============+==============+
1 | 123 |
2 | 456 |
Which query is the best and why:
SELECT Table1.customerId, Table2.customerPhone
FROM Table1, Table2
WHERE Table1.customerId = Table2.customerId
Query2:
SELECT Table1.customerId, Table2.customerPhone
FROM Table1
Inner Join Table2 ON Table1.customerId = Table2.customerId