Left Join, i.e.
SELECT DISTINCT user_data.* FROM user_data
LEFT JOIN prime_infos
ON user_data.country = prime_infos.country
With a LEFT join, all rows from the table on the left side of the equality sign will be shown.
Should they not have any associated rows in the other table, null values will be inserted. From the right table, only those rows get shown, which are associated with rows from the left table.
A RIGHT join works similarly, except this time all rows from the table on the right side of the equality are shown, i.e.
SELECT DISTINCT user_data.* FROM user_data
RIGHT JOIN prime_infos
ON user_data.country = prime_infos.country
So all rows from prime_infos get shown, but only those from user_data with associations in prime_infos.
A FULL OUTER join shows all rows from both tables. Those rows without any associations in the other table will have null values in the respective fields.
#sql #joins #databases #left #right #outer