An inner join will display only rows that match between two or more tables. If you want to display rows from a table regardless of a match with another table then you will code an outer join.
To learn how write outer joins, follow these steps:
outer joinkeywords. In addition, I've provided a table alias for each table (e.g., "s" for the States table) that I use to qualify potentially ambiguous references (e.g.,
namethat appears in both tables). I use the alias in the select list of columns and in the
onclause. Furthermore, note that in the
oncondition I check to make sure the state abbreviation in the States table is equal to the state abbreviation in the Cities table. This is necessary so that I display the correct city name located in that state. If a matching city is not found in the Cities table then the city name displays as
NULL. I've highlighted the two states (Maine and Texas) that do not have a match in the Cities table.