Overview

About ql.io

Language Overview

Runtime Overview

Usage Overview

Getting Started

Prerequisites

Quick Start

Build an App

Examples

Build and Develop ql.io!

Writing Scripts

create table

select

insert into

update

delete

URI Templates

Data Formats

Variable References

Configuration

Script Routes

Monkey Patching

OAuth

Executing Scripts

HTTP Interface

WebSocket Interface

Engine API

Monitoring

Runtime Monitoring

References

Language Reference

URI Template Syntax Reference

select Statement

The select statement is used to retrieve data. For well-designed HTTP APIs, a select maps to an HTTP GET. But if your APIs are using POST over XML or SOAP, a select may map to a POST request.

select columnsClause from fromClause whereClause limit offset
select {*|comma-separated columns with/without aliases} from
    {table|table1 as alias1, table2 as alias2}
    where {conditions}*
    limit {number}
    offset {number}

Examples

Select All

Try me
select * from finditems where keywords='iPhone'

This returns the complete response in JSON format. If the API returns XML, the XML will be transformed into JSON.

Select Fields

Try me
select title, itemId, primaryCategory.categoryName,
    sellingStatus.currentPrice from finditems where keywords='iPhone'

This returns results in a tabular form, with each row containing the selected fields.

Select Fields with Aliases

Try me
select title as title, itemId as id, primaryCategory.categoryName as category,
    sellingStatus.currentPrice as price from finditems where keywords='iPhone'

Nested Select

Try me
select ItemID, ViewItemURLForNaturalSearch, Location from details where itemId in
    (select itemId from finditems where keywords='mini cooper');

Join

Try me
select e.ItemID as id, e.Title as title, e.ViewItemURLForNaturalSearch as url, g.geometry.location as latlng
  from details  as e, google.geocode as g
  where e.itemId in (select itemId from finditems where keywords = 'mini')
  and g.address = e.Location

Clauses

Columns Clause

List of columns with or without alias names, or *

When using aliases, all selected columns must be aliased. Aliases must be prefixed with as.

From Clause

Up to two tables, in the natural order of dependencies.

When using a join, table names must be followed by as and an alias name.

Where Clause

List of zero or more conditions. Conditions must be separated by an and. Two types of conditions are supported.

Limit

The value of the limit is used to limit the number of results.

Offset

The value of this parameter is used to paginate a response.