Filters

You have the option to filter the records included in the query to identify a subset of records by using the WHERE clause.

This could be specify a particular age group, for example, or to only include results from a certain location.

The table below shows the operators available to apply filters:

Operator Explanation
> Greater than
>= Greater than or equal to
< Less than
<= Less than or equal to
= Equal
!= Not equal

 

Any of these operators can be used for numeric data, but only equal and not equal can be used for categoric data.

Using the greater than symbol as an example, you could write something like this:

WHERE Category > Integer 

So this part of the query would look something like this:

WHERE Income > 20000

To put it all together:

SELECT COUNT()

FROM
 (A Union B) Exclude C

WHERE
 Income > 20000

You can also apply filters to activation queries. This example returns a list of Twitter handles, but only if they are aged over 25. 

SELECT 
mydataset.TwitterHandle

FROM mydataset INTERSECT theirdataset

WHERE Age/"Years Old" < 25

If you're used to writing queries in SQL, note that you don't need to use the JOIN keyword in IQL. InfoSum automatically performs the join between multiple datasets when they are referenced in a single query.

Using multiple filters

You can apply as many filters as you like to your datasets by using the AND, OR and NOT operators.

To do so, write something like this:

WHERE Category > Integer AND Category = String

So this part of the query would look something like this:

WHERE Income >= 20000 AND Age < 30

To put it all together:

SELECT COUNT()

FROM
 (A Union B) Exclude C

WHERE
 Income >= 20000 AND
 Age < 30

Next steps

There are two additional optional clauses available: