Loosely based on the query you posted. Imagine you have two tables: country and city
For example country holds following data:
And city holds following data: The citie's name, an internal number and the country's number it is located in.
ID | name
1 | Europe
2 | America
3 | Africa
Here the column "continent" references the column ID in the table continent.
cityid | name | continent
1 | Berlin | 1
2 | London | 1
3 | Utah | 2
If you use:
you check where the numbers in the column "id" in table "continent" exactly match the same number in the column "continent" in the table "city".
SELECT continent.name, city.name
FROM continent, city
WHERE continent.ID = city.continen;
That query would return:
Because the table "city" does not contain a city which is located in Africa (i.e. no 3 in the column continent) no rows for "Africa" are returned.