Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LEFT JOIN vs FULL JOIN
Message
From
17/06/2011 10:03:36
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01514564
Message ID:
01514878
Views:
62
>Where do you see that Table1 has more records than Table2 in my example? And now you are adding RIGHT JOIN to the mix (before we only talked about LEFT JOIN and FULL JOIN). Also, keep in mind that the number of records in Table1 and Table2 can vary. It is not always that one has more records than the other. But what I am wondering is, what is the hypothetical example where FULL JOIN will not give me the right results?
>
>UPDATE. I am sorry. I misread. I see that you agree that I need FULL JOIN. Thank you.

Here is an example from my Oracle course: Employees have a department number, but one employee has the "department_id" field blank. If doing an inner join, only 19 out of 20 employees will be shown, because there is no matching record in departments. Similarly, the sample data includes a department to which no employee is assigned, so not all departments will be shown.

When doing a LEFT join (employees is named first), all employees are included, when doing a RIGHT join, all departments are included.

The examples also show a FULL join, but over the years I have not seen a single situation where such a join is of any practical use. I did use both inner and outer joins (left or right) regularly.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform