Why Left Join for SQL Joins Using WHERE or ON Practice Problem 1
So I am going through tutorials and I am at SQL Joins Using WHERE or ON Practice Problem 1
In the solution Query uses Left Join, while I get same results with simple inner Join.
When I use Left Join I need to filter out Null Status values.
Why does Query use Left Join.
Hi MP - The results of using an INNER JOIN vs a LEFT JOIN are not quite the same. The difference is that by using a LEFT JOIN, you'll return all companies from the companies table (even those which do not have records in the investments table). This means that some companies will return a unqiue_investors count of 0. Whereas if you use an INNER JOIN, you will only return rows for companies that also have a record in the investments table.
Since the instructions for that practice problem don't mention excluding companies without investments, a LEFT JOIN is the approach I would take here.Reply