Complex for me, since I'm new to SQL.
I have three tables: Peoples , Interests and Peoples_Interests (many-to-many), which are related as follows:
People has many Interests through Peoples_Interests
Interest has many Peoples through Peoples_Interests
I need to offer proposals to peoples with peoples most similar to them, which are based on the number of similar interests. So for example :
I'm interested in baseball, soccer and volley. I have to get an offer with another user who has as many similar interests as possible. People with 3/3 cases should be what I need if they exist (if not - 2/3, etc.).
So I need a query whose output will consist of sorting by interests of Peoples similarity.
UPDATE: Db structure:
Interests
identifier
name - string
Little people
identifier
Email
Peoples_Interests
interests_id
peoples_id
Thanks.
source share