DEV Community

RyzeNMagic
RyzeNMagic

Posted on

Best way to store pharmacies + medicine in MySQL?

I have multiple pharmacies, each one has a number of medicine but more than one can have the same one.

I can add or remove pharmacies.

What's the best way to store them in mySQL database. Do i create a table for each pharmacy? or one table for all of them?

Top comments (1)

Collapse
 
newelement profile image
Don Jones  • Edited

You need a table to store all the pharmacies. You will need a table to store all the medicines. Then you need a pivot table to assign medicines to pharmacies. Please look into pivot tables and how to join your tables in a query.