!! Note the use of substr in this query !!
Other functions that are available are now(), strlen(), substr() and strpos().

Fetch URL to execute the query

XML and JSON are supported formats. I am using JSON for this example.
$oauth_token is obtained by the Facebook's Authentication: you need to create a Facebook App first and get the user to login and grant permission to your app (I will do a followup post ...)

FQL Test Console

There is a great test console where you can play with the queries. With another user account FQL console gave me "Something went wrong. We're working on getting it fixed as soon as we can." It seems you need to have an Application setup and the test user might need to have granted the extra permissions him/herself.

A handy trick is to click on the URL in the FQL console, it will open a new tab with the URL to fetch. For example 1 that would be:

FQL Tables

Of course a lot more is possible, see all Tables. The only limitation is that you can only query indexable properties (columns)

What's next?

In the next post I will iterate over example 4. (birthday calendar) to show you how to use FQL as a workhorse for the input of your Facebook app. I will also cover some more aspects of the Facebook API like authorization and dialogs ...