There will be cases where you want to join two (2) table and display records that has match or even without match on the other table.
Table
STUDENT |
GRADES |
Refer on the table above.
Query
SELECT * FROM student left join grade on student.stud_id=grade.stud_id
If you want to display all students even without grades, then you can use SQL LEFT JOIN or RIGHT JOIN. The LEFT JOIN will display all records on the left table even without match on the right table. The RIGHT JOIN will display all records on the right table even without a match on the left table.
Output
0 comments:
Post a Comment