SQL INNER JOIN Syntax :
SELECT column_name(s) FROM table1 INNER
JOIN table2 ON table1.column_name=table2.column_name;
OR
SELECT column_name(s) FROM table1 JOIN table2
ON table1.column_name=table2.column_name;
-- This is used to filter with the ids for the tables which
have the relation
Example :
SELECT users.users_ID, Member.Member_Id FROM users INNER
JOIN member ON users.Users_id=member.Member_Id;
SQL LEFT JOIN Syntax :
SELECT column_name(s) FROM table1 LEFT
JOIN table2 ON table1.column_name=table2.column_name;
OR
SELECT column_name(s) FROM table1 LEFT
OUTER JOIN table2 ON table1.column_name=table2.column_name;
Example :
SELECT users.users_id, Orders.Orders_ID FROM Users LEFT JOIN
Orders ON users.users_ID=Orders.orders_id ORDER BY users.users_id;
SQL RIGHT
JOIN Syntax
SELECT column_name(s) FROM table1 RIGHT
JOIN table2 ON table1.column_name=table2.column_name;
Example :
SELECT users.users_id, Orders.Orders_ID FROM Users RIGHT
JOIN Orders ON users.users_ID=Orders.orders_id ORDER BY users.users_id;
SQL FULL OUTER JOIN SYNTAX
SELECT column_name(s) FROM table1 FULL
OUTER JOIN table2 ON table1.column_name=table2.column_name;
Example :
SELECT Users.Users_id, Orders.orders_id FROM users FULL
OUTER JOIN Orders ON users.users_id=Orders.orders_ID ORDER BY users.users_id;