sql joining 3 tables 1

sql joining 3 tables

# no need to use parentheses - works fine
SELECT * FROM names A
INNER JOIN address B ON A.personID = B.personID
INNER JOIN emailAddress C ON A.personID = C.personID
INNER JOIN phoneNumbers D ON A.personID = D.personID;

Here is what the above code is Doing:
1. We’re selecting all columns from the names table.
2. We’re joining the address table to the names table on the personID column.
3. We’re joining the emailAddress table to the names table on the personID column.
4. We’re joining the phoneNumbers table to the names table on the personID column.

Similar Posts