Understanding many-to-many table relationships

In a many-to-many relationship, one table corresponds to many rows in another table. In addition, one item from one table can correspond to multiple rows in the other. An example of this could be tables of customers and products. Customers could purchase many products, and many products can be purchased by many customers. In the case of the baseball database, an example of a one-to-many relationship is the appearances table's relationship to the batting table. There are many rows per playerid in the appearances table and there are many rows for each of those playerids in the batting table.

The following screenshot shows an example of a many-to-many relationship:

The following screenshot shows ...

Get Learn SQL Database Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.