Specifying the Elements Returned (Projection)

To get a vertical slice (projection) of a table, specify the fields in the clause following the SELECT keyword. In YQL, these fields are analogous to the columns of a SQL table. Multiple fields are delimited by commas, for example:

select lastUpdated, itemurl from social.updates where guid=me

To get all fields, specify an asterisk:

select * from social.updates where guid=me

If the fields in the result set contain sub-fields, you can indicate the sub-fields by using periods (dots) as delimiters. (Sometimes this format is called "dot-style syntax.") For example, for the social.profile table, to get only the imageUrl sub-field of the image field, enter the following:

select image.imageUrl from social.profile where guid=me

The following lines show part of the XML response for this SELECT. Note that only the imageUrl sub-field is returned.

If you specify one or more non-existent fields in the what clause, the HTTP response code is 200 OK. If none of the fields in the what clause exist, the result set is empty. (That is, zero rows are returned.) Note that field names are case sensitive.

Table of Contents