Select query with LEFT/RIGHT/FULL JOINs on multiple tables
SELECT column, another_column, …
FROM mytable
INNER/LEFT/RIGHT/FULL JOIN another_table
ON mytable.id = another_table.matching_id
WHERE condition(s)
ORDER BY column, … ASC/DESC
LIMIT num_limit OFFSET num_offset;
a LEFT JOIN
simply includes rows from A regardless of whether a matching row is found in B.
表示仅仅只是保留A 中的行数不管是否能找到B中
The RIGHT JOIN
is the same, but reversed, keeping rows in B regardless of whether a match is found in A
仅仅保留B
a FULL JOIN
simply means that rows from both tables are kept, regardless of whether a matching row exists in the other table.
A&B 都保留