I have three tables:
I want to select only those rows from
locations table where
professional_id is 4. What's the best way to do this?
professionals also have their PK columns as
professional_id, respectively, and
location_professional uses those columns to link the two entities:
SELECT loc.* FROM location_professional AS lp JOIN locations AS loc ON lp.location_id = loc.location_id WHERE lp.professional_id = 4;
In your simple example, there is no need to also
JOIN professionals AS p ON .... In a typical case, that would also be needed.