I have a database that has two tables ‘locations’ and ‘classes’. I am familiar setting up some sort of parent/child situation with my database tables, but this one has thrown me for a loop.
This relationship works exactly like you’d expect. The ‘locations’ have multiple ‘classes’. But some of the ‘classes’ are at multiple ‘locations’. So how do I set this up? Does there need to be a third table created to handle the relationships?
I am using MySQL/PHP (in case that matters)
You need a join table:
Something along those lines, essentially the classlocation table joins the other two (both locationId and classID are foreign keys from the location and class tables)