How to count in relational algebra without aggregate functions?


Find the user who has liked the most posts. Report the user’s id, name and email, and the id of the posts they have liked. If there is a tie, report them all.

The schema:

User(uid, name, website, about, email, phone, photo)  Likes(liker, pid, when)  Likes[liker]  is contained in  User[uid] 

I think I need a "function" NumberOfLikes or similar where I can do something like:

enter image description here

We aren’t allowed to use aggregate functions in this exercise. I assume the way to count in RA is by performing some sort of cross product black magic, but I don’t know how.

Help?