The FROM clause defines the intended audience, which can be as simple as specifying the dataset or using operators to build relationships between 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. Please see the quality metrics article for an in-depth explanation of query quality.
In the SELECT clause article, insight and activation queries were discussed separately, as the syntax is differently for the SELECT clause. For every other clause, the syntax is the same.
Reference a published dataset
To specify the dataset, after the SELECT clause, simply write:
So, it would look something like this:
Build relationships with operators
If you want to, you can select the union, intersection or exclusion of datasets by using operators. The diagram below shows how they can be used to define an exact audience.
To use the operators, write something like this:
FROM A Union B
FROM A Intersect B
FROM A Exclude B
You can also use multiple operators at once, for example:
FROM (A Union B) Exclude C
FROM A Intersect (B Exclude C)
The operators are evaluated from left to right, except when parentheses are used which can be used to change the order.
After the SELECT and FROM clauses, there are three optional clauses available:
- the WHERE clause, which applies a filter to the records included
- the ENRICH WITH clause, which includes categories from other datasets
- the LINK WITH clause, which uses glue datasets to link keys