Select query type
As we explained in an introduction to IQL, the first part of any query is using the
SELECT clause to specify the type. This defines whether the objective of the query is to produce aggregated insights or a list of identifiers:
- Insight queries are your way to analyse connected data without the risk of identifying individuals. This type of query enables privacy-safe analysis and collaboration across separated datasets and only produces aggregated insights.
- Identity queries are your way to generate a list of identifiers which can be pushed elsewhere as an audience, and are disabled by default. Because the results identify individuals, it is important to consider legal and regulatory requirements whenever you use an identity query.
FROMclauses are mandatory, so the examples shown will include both clauses. The following article will describe the
FROMcomponent and its operators in more detail.
In an insight query, the
SELECT clause references the published datasets, defines which categories will be aggregated and determines how the resulting statistics will be displayed.
To do so, simply specify the dataset, the category and how you would like the statistics to be reported as shown below:
(mydataset.category, bin1, bin2, bin3),
So the query would look something like this:
(A.Age, 10, 15, 20, 25, 30),
(A.Gender, 'Female', 'Male')
As you can see, the names of categoric bins are surrounded by single quote marks. In IQL (like in SQL), single quote marks identify a string literal.
The way you define the bins for numeric and categoric data is different. In the age example above, the specification of
(10, 15, 20, 25, 30) will output the bins
([10, 14], [15, 19], [20, 24], [25, 29]), whereas
'Male' will be outputted as two categorical bins.
Alternatively, you can infer the bins based on representations. For example, rather than listing out the five year bins, you can simply specify a representation such as
"5 Year Bins". To do so, write something like the following:
(A.Age/”5 Year Bins”),
As you can see below, a
/is using to separate the category from the representation. The names of the representations are also surrounded by double quote marks to identify a representation, rather than a bin.
For an identity query, the
SELECT clause in IQL is extremely simple. Just specify the name of dataset and the output column you want to return, for example:
SELECT mydataset.outputcolumn FROM mydataset
You can select any number of output columns from the datasets:
SELECT A.Email, A.Flag FROM A
The next step of any IQL query is to use the mandatory
FROM clause. This enables you to define an audience by referencing published datasets and specifying the relationships, for example by using operators to define the union, intersection or exclusion of multiple datasets.