Inner joins (aka equijoins)
Basic joining (no need to specifically put in the "INNER JOIN" term). Example:
SELECT lastname, firstname, tag
FROM drivers, vehicles
WHERE drivers.location = vehicles.location
Left join
Returns all rows from the left table (table1) even if there are no matches in the right table (table2). Example:
SELECT *
FROM table1 LEFT JOIN table2 ON table1.column1 = table2.column2
Right join
Returns all rows from the right table (table2) even if there are no matches in the right table (table1). Example:
SELECT *
FROM table1 LEFT JOIN table2 ON table1.column1 = table2.column2
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment