Categories
SQL

Reprezentare grafica simpla a tipurilor de SQL JOIN

INNER JOIN

SELECT <fields>
FROM A
INNER JOIN B ON (A.key = B.key)

LEFT JOIN

LEFT JOIN

SELECT <fields>
FROM A
LEFT JOIN B ON (A.key = B.key)

 

RIGHT JOIN

RIGHT JOIN

SELECT <fields>
FROM A
RIGHT JOIN B ON (A.key = B.key)

 

OUTER JOIN

OUTER JOIN

SELECT <fields>
FROM A
FULL OUTER JOIN B ON (A.key = B.key)

 

LEFT ONLY JOIN

LEFT ONLY JOIN

SELECT <fields>
FROM A
LEFT JOIN B ON (A.key = B.key)
WHERE B.key IS NULL

 

RIGHT ONLY JOIN

RIGHT ONLY JOIN

SELECT <fields>
FROM A
RIGHT JOIN B ON (A.key = B.key)
WHERE A.key IS NULL

 

LEFT ONLY AND RIGHT ONLY JOIN

LEFT RIGHT ONLY JOIN

SELECT <fields>
FROM A
RIGHT JOIN B ON (A.key = B.key)
WHERE A.key IS NULL AND B.key IS NULL

Leave a Reply

Your email address will not be published. Required fields are marked *