I am starting to understand the join functions. I am still having a bit of a hard time with the literal meaning of right and left join.
For example when should I use a right and left join.
If these were the two tables
tbl_teacher
id | dept | teacherName |
-------------------------
01 | 02 | Mary Jones |
01 | 01 | Jane Smit |
01 | | James Joes |
01 | 02 | Joey Joes |
01 | 01 | Mike Jons |
Dept
id | dept |
-----------
01 | Computer Sci |
02 | Design |
03 | Math |
How do I determine which join to use if I want to return a query with only teachers with depts that are not null.
Also how would I return a query with the names of the depts (departments) and leave a null row for the teacher name.
I am just not understand the meaning of right, left, and inner join. Can someone please give a very basic of example of each. How is one right or left. I do not understand.
Thanks everyone. This site is helping speed up my learning and thank you in advance for any help!
- James
For example when should I use a right and left join.
If these were the two tables
tbl_teacher
id | dept | teacherName |
-------------------------
01 | 02 | Mary Jones |
01 | 01 | Jane Smit |
01 | | James Joes |
01 | 02 | Joey Joes |
01 | 01 | Mike Jons |
Dept
id | dept |
-----------
01 | Computer Sci |
02 | Design |
03 | Math |
How do I determine which join to use if I want to return a query with only teachers with depts that are not null.
Also how would I return a query with the names of the depts (departments) and leave a null row for the teacher name.
I am just not understand the meaning of right, left, and inner join. Can someone please give a very basic of example of each. How is one right or left. I do not understand.
Thanks everyone. This site is helping speed up my learning and thank you in advance for any help!
- James