Definition:
table_A table_B
id,description id,description,id_table_A
Column id_table_A
is a foreign key to the primary key of table_A
and is not mandatory.
Sample data:
table_A
1,some_desc_1
2,some_desc_2
table_B
1,some_desc_1,1
2,some_desc_2,2
3,some_desc_aaa,null
4,some_desc_bbb,null
I need to write a query that shows me all the records, including the records with the foreign key set to null. What type of join is this? I'm not able to show the records with null foreign key using an INNER JOIN
.
Best Answer
Outer joins...