How to "join" two tables without PRIMARY KEYs I have two tables in which there are no primary nor foreign keys.


Table 1 (Persons):
name, region, department
Table 2 (Access):
name, access_level


How can I answer the following question:


  How many people in each department have data access?
If we're to assume that these tables are actually used to determine who has access, then the query from blobbles' answer is the answer, even if there are multiple people with the same name in Persons.

If there are 4 "John Smith"s in Persons, and Access indicates "John Smith" has data access, then every "John Smith" would have data access.

If this is merely a record of access granted (rather than what defines the access granted), and Persons.name is not unique, then you can't know for certain. Perhaps two "John Smith"s have been granted access, perhaps only 1, perhaps none. The record is incomplete, because we don't know how access ties back to different Persons with the same name.