The Two-Minute Tutorial

This tutorial shows you how to run YQL statements and examine the resulting data with the YQL Console.

  1. In your browser, run the YQL Console.
  2. Under "Example Queries", click get san francisco geo data. The console calls the YQL Web Service with the following query:

    select * from geo.places where text="san francisco, ca"

    This SELECT statement requests geo data about San Francisco. The "*" indicates that all fields of the geo.places table will be returned. In the filter of the WHERE clause, the string "san francisco, ca" is the value of the search query.

  3. Note the XML response in the FORMATTED VIEW tab. The information from the geo.places table is in the results element. To get the response in JSON format, select the JSON radio button and click TEST.
  4. In Your YQL Statement, replace the "*" with the name and country fields:

    select name, country from geo.places where text="san francisco, ca"

    Make sure that name and country are lowercase. Unlike SQL, in YQL the field and table names are case sensitive.

  5. To run the command in Your YQL Statement, click TEST. The returned place fields should only have the name and country sub-elements.
  6. In the console, examine the URL below REST query:

    To call the YQL Web Service, an application would call an HTTP GET method on this URL. The q parameter in the URL matches the SELECT statement displayed under Your YQL Statement (except that characters such as spaces are URL encoded). The COPY URL button copies this URL to your clipboard, so that you can paste it into the source code of an application.

  7. To view YQL's pre-defined tables, expand the Data Tables list on the right side of the console. You can run an example query on each of these tables by clicking the table name.
  8. Advanced: To view the description of a table, under Data Tables, expand the geo menu to see all of the Geo tables. Move your mouse cursor over the table name geo.places, then click desc. On the TREE VIEW tab, take a look at these nodes: "query->results->table". The nodes under the "table" node contain information such as meta-data and search fields (input keys). For more information on input keys, see Remote Filters.

Table of Contents