This is a post for me to aggregate various FQL queries.
Fetch the Facebook like count for a given URL
SELECT like_count FROM link_stat WHERE url="http://www.stevetrefethen.com/blog/"
Facebook user’s connections
SELECT target_id,target_type,is_following FROM connection WHERE source_id = facebook_userid
Facebook Share count on a page
SELECT share_count, like_count, comment_count, total_count FROM link_stat WHERE url="http://www.stevetrefethen.com/school/"
Fetch open graph id for a url:
SELECT id,type,site FROM object_url WHERE url="http://www.stevetrefethen.com/school/"
View which groups a user belongs to
SELECT name,gid FROM group WHERE gid IN (SELECT gid FROM group_member WHERE uid = facebook_userid)
Fetch a “friend map”
Replace UID with logged in user id. Via this page.
SELECT uid1, uid2 FROM friend WHERE uid1 IN (SELECT uid1 FROM friend WHERE uid2=UID) AND uid2 IN (SELECT uid1 FROM friend WHERE uid2=UID) AND uid1 < uid2
Names of the places you’ve checked in
SELECT name FROM page WHERE page_id IN (SELECT page_id FROM checkin WHERE author_uid = me())
Names of the Places your Friends have checked in
SELECT name FROM page WHERE page_id IN (SELECT page_id FROM checkin WHERE author_uid IN (SELECT uid2 FROM friend WHERE uid1 = me()))
You can play around with executing these here including your Facebook user id if you’re logged in.