An introduction to IQL
InfoSum’s Insight Query Language (IQL) provides the ability to analyze connected data.
Loosely based on SQL, IQL enables you to join, filter and enrich any number of datasets.
This article will describe the core capabilities of the language and the structure of a query. The following articles will then break down the different clauses and functions and explain how to write queries in IQL.
There are three main components to any query - specifying the type of query, the categories to be used and the intended audience - and three optional tools - applying filters to the intended audience and enriching information or linking keys with additional datasets.
IQL supports two types of queries with different outputs. An insight query returns statistical results founded on aggregated data, whereas an activation query returns a list of identifiers that relate to specific individuals. The query type is defined alongside with defining the categories you intend to use and how you would like the results to be displayed.
You will only be able to run an activation query on activation datasets owned by you or those which you have permission to use in this way. For more information on permissions, see permission levels.
The intended audience is then defined by referencing published datasets and specifying the relationships, for example by using operators to define the union, intersection or exclusion of multiple datasets. Specifying an audience in this way allows our platform to understand what you are trying to achieve, so any loss of quality in the results caused by poor information or overlaps can be highlighted.
There are then several additional clauses available to help you achieve your objective:
- Apply any number of integer or string filters, such as to only include females over 30 and have an income of £40,000 or more, or anyone who lives in Dorset or is interested in sailing.
- Enrich your analysis by using categories held in additional datasets, such as by including demographic categories held within a separate dataset that you have permission to query.
- Reference another dataset to link keys across datasets, for example by using a glue dataset to find out which individuals appear in two datasets that hold different customer identifiers.
There are three IQL functions available to help you analyze datasets:
- COUNT returns the number of records in a dataset or combination of datasets.
- AGGREGATE performs a calculation on individual records and returns a summarized representation of those values.
- TOPN runs an AGGREGATE query on the entire dataset and returns the top number of aggregated values, sorted from highest to lowest.
For more information on these functions, see IQL functions.
The structure of a query
A query in IQL always references one or more datasets, using its Private ID. A dataset is roughly analogous to a table in a conventional database system. You can use a dataset in an IQL query if you are its owner, or if you have permission to reference it.
An IQL query comprises of several parts:
- a SELECT clause, which specifies the query type and the categories to be used
- An IQL function, which analyzes connected data
- a FROM clause, which defines which datasets will be used to create the audience
- an optional WHERE clause, which applies a filter to the records included
- an optional ENRICH WITH clause, which includes categories from other datasets
- an optional LINK WITH clause, which uses glue datasets to link keys
The following articles describe these clauses and functions in more detail.