Search code examples
mysqlsqldatabase

How to link pharmacies table with medicine table?


I have this two MySQL tables.

Pharmacies table

Pharmacies

Medicine table

Medicine

How can i link this two tables So that each pharmacy have their own medicine stock(One medicine can be in multiple pharmacies).


Solution

  • I would create a third table to join the two, something looking like this.

    ------------------------
    | pID | mID | Quantity |
    ------------------------