Rule-Based Matchmaking In a Networking Event

Imagine you are organising a virtual networking event where attendees join a series of 1:1 video calls with different people.
In most cases, participants can be matched randomly. But sometimes, you want certain restrictions like:
CEOs should only meet Investors
Designers should only meet Product Managers
Students should match only with Mentors
To enable this, we introduce matchmaking rules.
Database Tables Needed
To make this possible, there should be some tables in your system.
Groups Table
CREATE TABLE Groups (
id INT PRIMARY KEY,
name VARCHAR(50)
);
Each user can belong to one or more groups (CEO, Investor, Mentor, etc.).
Users Table
CREATE TABLE Users (
id INT PRIMARY KEY,
name VARCHAR(50)
);
User–Group Mapping Table
CREATE TABLE User_Groups (
user_id INT PRIMARY KEY,
group_id INT PRIMARY KEY,
FOREIGN KEY (user_id) REFERENCES Users(id),
FOREIGN KEY (group_id) REFERENCES Groups(id)
);
Since one user can belong to multiple groups,
Networking Table
CREATE TABLE Networking (
id INT PRIMARY KEY,
name VARCHAR(100)
);
Rules Table
CREATE TABLE Rules (
id INT PRIMARY KEY,
networking_id INT,
from_group_id INT,
to_group_id INT,
FOREIGN KEY (networking_id) REFERENCES Networking(id),
FOREIGN KEY (from_group_id) REFERENCES Groups(id),
FOREIGN KEY (to_group_id) REFERENCES Groups(id)
);
from_group_id is the first group of the rule and to_group_id is second group of the rule.
Creating Matchmaking Rules
Now that we have these tables in our database, we can start creating matchmaking rules for a networking event.
The rule system is simple:
The organiser selects which groups are allowed to match with each other and the groups which are not included in the rule will get matched with each other.
Group-Based Rule Scenarios
Let’s consider the following groups:
A, B, C, D, E
And the organiser sets these rules:
Group A → Group B
Group B → Group C
Group A → Group A
Based on these rules:
Group A can match with A and B
Group B can match with A and C
Group C can match only with B
Groups D and E, which are not part of any rule, will match only with each other
What Happens When a User Belongs to Multiple Groups?
Now imagine a user who is in both Group C and Group D.
How should matchmaking work for this user?
Since Group C has a rule allowing it to match only with Group B, the user’s allowed match groups will follow the strictest rule and it will be matched only with Group B users.
Even though the user also belongs to Group D, which normally matches with E, Group C’s rule takes priority because Group B → Group C defines a restricted matchmaking rule.




