i asked this question around a single join or multiple (select n + 1) queries
i wanted to find out if this was the same if you had many to many relationship and a lot of bridge tables
for example, here are my tables:
Table: People (id, first, last, age, phone, etc . .)
Table: Roles (id, name)
Table: PeopleRoles (id, personID, roleID)
Table: Skills (id, name)
Table: PeopleSkills (id, personID, skillID)
so if i did a join, i would get multiple rows for each person (assuming a person has many roles or multiple skills).
assuming there are many more tables like this with many relationships, which is faster:
Option 1:
- Select * from applications
- then loop through each application and run a Select * from Roles where applicationID = id inner join
Option 2:
or trying to create one massive query that returns a large result set and i then need to normalize it when i translate this into data structures (as i will get the same application in multiple rows of course.