Visual Learning of MySQL Joins

  • Inner Join - MySQL Join
  • Left Join - MySQL Join
  • Right Exclude Join - MySQL Join
  • Left Exclude Join - MySQL Join
  • Outer Exclude Join - MySQL Join
  • Outer Join - MySQL Join
  • Right Join - MySQL Join
Image specifications: 32.25kb , 924x530 pixels , png , LEFT JOIN - MySQL
Image Description: Left Join - MySQL Join
Detail of image:
Image Source: V2

A simple way for don't forget MySQL Joins.

This learn contains:

  •  MINUS RIGHT JOIN  or LEFT EXCLUDE JOIN
  • OUTER EXCLUDE JOIN
  • MINUS LEFT JOIN or RIGHT EXCLUDE JOIN
  • INNER JOIN
  • LEFT JOIN
  • RIGHT JOIN
  • OUTER JOIN

MINUS RIGHT JOIN or LEFT EXCLUDE JOIN

SELECT * FROM A LEFT JOIN B ON A.ID = B.ID WHERE B.ID IS NULL

OUTER EXCLUDE JOIN

SELECT * FROM A LEFT JOIN B ON A.ID = B.ID 
WHERE B.ID IS NULL
UNION ALL 
SELECT * FROM A RIGHT JOIN B ON A.ID = B.ID
WHERE A.ID IS NULL

MINUS LEFT JOIN or RIGHT EXCLUDE JOIN

SELECT * FROM A LEFT JOIN B ON A.ID = B.ID WHERE B.ID IS NULL

INNER JOIN

SELECT * FROM A INNER JOIN B ON A.ID = B.ID

LEFT JOIN

SELECT * FROM A LEFT JOIN B ON A.ID = B.ID

RIGHT JOIN

SELECT * FROM A RIGHT JOIN B ON A.ID = B.ID

OUTER JOIN

SELECT * FROM A LEFT JOIN B ON A.ID = B.ID 
UNION ALL 
SELECT * FROM A RIGHT JOIN B ON A.ID = B.ID 
WHERE A.ID IS NULL

Tags

No tag here.