Queries are of the form SELECT [fields] FROM [table] WHERE [conditions]. Unlike SQL, the FQL FROM clause can contain only a single table. You can use the IN keyword in SELECT or WHERE clauses to do subqueries, but the subqueries cannot reference variables in the outer query’s scope.

FQL can handle simple math, basic boolean operators, AND or NOT logical operators, and ORDER BY and LIMIT clauses. For any query that takes a uid, you can pass me() to return the logged-in user.

Available Functions:
me()
now()
rand()
concat(string, ...)
strlen(string)
substr(string, start, length)
strpos(haystack, string)
contains(string)
upper(string)
lower(string)
distance(latitude, longitude, "float", "float")

Supported Operators:
AND, OR, NOT, IN, ><=, +-*/

Order/Limit/Offset
ORDER BY field DESC LIMIT 100 OFFSET 0

The FQL component of Facebook's API is powerful but it can be difficult to find useful examples. The following is a compiled list of queries that I found to be useful and interesting. Feel free to test them with the Facebook Graph API Explorer. If these examples have helped you, please like my page and follow me on twitter (links below). If any FQL is broken or unclear, let me know.

Last Updated: March 4, 2014

List my Likes

List my Group Likes

List my Liked Links

List my Available Streams

Show my Stream (included all stream properties)

Show my Newsfeed Stream

View my Stream published by any Application

View my Stream published by a specific Application ID (eg. The Guardian)

View my Stream published by a specific Application Name (included all stream properties) (eg. Facebook for Android)

Show my Status Updates (possibly deprecated)

Show my Status Updates which contain the word 'work' (possibly deprecated)

Show Status Updates from Friends which contain the word 'work' (new alternative)

List Pages I have liked

List Pages where I am Admin

List my Photos that I have been tagged in after March 1, 2013 (sorted by like count)

List my Photos from Albums that I have uploaded after March 1, 2013

List Friends (sorted by last name)

List Friends that have the current Application installed

List Friend's Relationship Status

List Friend's Birthday (sorted by month)

List Friend's Likes (Facebook seems to have removed this functionality)

List Friend's Liked 'youtube' Links

List Friend's Liked Links who have the current Application installed

List Friends Liked 'youtube' Links who have the current Application installed

View a specific Friend Stream (eg. me)

View the Stream of Friends

View the Stream of Friends who have the current Application installed

View Friend's Education/School History

View Friend's Employer/Work History

View Friend's Interests

View Friend's Favourite TV Shows

View Friend's Favourite Movies

View Friend's Favourite Music

View Friend's Favourite Books

View Friend's Sports Played

View Friend's Languages Spoken

View Friend's Devices (eg. iPhone, Android)

View Friend's Current Location

View Friend's Hometown Location

List Friends with a first name like 'mike' (case insensitive)

View Friend's Subscriptions to other Facebook Users

List the IDs of your Friend's Significant Others

List the Significant Others of your Friends

Show the Total Likes of Friends (Show who likes things often / Uses Facebook often)

View Friend's Stream published by the current Application

List Friend's Action links

Show Statistics for a specific Link/URL (eg. http://www.youtube.com)

List Pages with 'mcdonalds' in name

List Places within a 400 metre radius (seems to limit results to a max of 30, so use a small radius for accuracy)

Show Place information for a given list of page_ids/place_ids (eg. McMaster University and Mohawk College)

List checkins from your friends that have happened in the last 6 months (2678400 seconds in a month)

Below are responses to FQL questions sent to me.
View Friend's Employer/Work History from a specific country (eg. singapore) and from a specific company (eg. Bank Divishion) (asked by Ranganatha)

Tags: