What is MySQL LEFT JOIN and how can we write MySQL query for it?
Answers
Answered by
2
Let’s assume that you are going to query data from two tables t1 and t2. The following statement illustrates the syntax of LEFT JOIN clause that joins the two tables:
1
2
3
4
5
6
SELECT
t1.c1, t1.c2, t2.c1, t2.c2
FROM
t1
LEFT JOIN
t2 ON t1.c1 = t2.c1;
When you join the t1 table to the t2 table using the LEFT JOIN clause, if a row from the left table t1 matches a row from the right table t2 based on the join condition ( t1.c1 = t2.c1 ), this row will be included in the result set.
I hope this will help you.
Similar questions
Social Sciences,
5 months ago
Chemistry,
5 months ago
Psychology,
5 months ago
Chemistry,
10 months ago
English,
11 months ago
Math,
11 months ago