Hint and exampleShowHide
Build every possible pair with CROSS JOIN, then LEFT JOIN the activity table and count one of its columns so that pairs with no activity show 0.
Example: members(name), games(game) and played(name, game)
members: Asha, Ravi games: Carrom, Chess
played: (Asha, Chess), (Asha, Chess)
SELECT m.name, g.game, COUNT(p.game) AS times
FROM members m
CROSS JOIN games g
LEFT JOIN played p ON p.name = m.name AND p.game = g.game
GROUP BY m.name, g.game
ORDER BY m.name, g.game;
-- Asha|Carrom|0, Asha|Chess|2, Ravi|Carrom|0, Ravi|Chess|0