YQL or Yahoo Query Language allows developers to query, join and filter data from multiple data sources on the web who have made their data available through the YQL interface. Since YQL is an expressive SQL like language, developers familiar with the SQL interface should feel comfortable with the interface.
YQL provides the developers a consistent way to access online services which are otherwise dispersed across a range of formats. It hides the implementation of the various data sources on the web and make it easier to query the data.
YQL is both a service and a language. The service is through which external web services can make their data available for developers to consume through the yahoo query ‘language’.
Understanding the language of YQL
If you are familiar with the SQL, you will feel at home with YQL. This language allows developers to use SQL syntax to extract data from the service. It can return the results in either XML format or in JSON format.
Yahoo has provided a YQL Console for developers to test their queries.
For example, if the application wants to search from YouTube and display a list of results, the developer can use a simple query like below and get the information from the web service.
1
SELECT *FROM youtube.search WHERE query="soccer ronaldo"
The output of the above query in XML format is below. Adding ‘limit 1’ will limit the output to the top 1 result.
Similar to SQL, YQL also let the developer query for individual columns. The developer can limit what is returned from the service by specifying the data that should be returned as in the below example.
1
SELECT id,url,title,content FROM youtube.search WHERE query="soccer ronaldo"limit1
Which returns just those 4 columns that are requested.
The application can post this query to get the response and the response being in XML or JSON consistently across the web services makes this interface very luring to use.