I have searched for other questions and I was able to solve part of what I wanted but I couldn\'t get any further from that.
I have a table with two columns(user, friend
You can use a self-join:
select f1.user as user1, f2.user as user2, count(*) as num_in_common from friends f1 join friends f2 on f1.friend = f2.friend group by f1.user, f2.user;
You can add a where clause if you want this information for a particular pair of users.
where