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.
substr(string, start, length)
distance(latitude, longitude, "float", "float")
AND, OR, NOT, IN, ><=, +-*/
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