Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Match all profiles where the company does not end with the word google Google based on the regex pattern google$Google$.

SQL Example

Code Block
linenumberstrue
select count(*) from (
select
a."cdp_customer_id"
from "cdp_audience_409"."customers" a
where not coalesce(regexp_like(a."company", 'google$Google$'), false)
-- set session distributed_join = 'true'
) cs

...

not regex

...

does NOT match based on a regular expressions pattern (regex). You must provide the regex pattern that works for your use case.

match all profiles where the company does not end with the word google based on the regex pattern google$.

select count(*) from (
select
a."cdp_customer_id"
from "cdp_audience_409"."customers" a
where not coalesce(regexp_like(a."company", 'google$'), false)
-- set session distributed_join = 'true'
) cs

...

is between

...

between two provided values

...

is between

Use the in between operator to not match all profiles between to provided values.

Example

Match all profiles with a likely_to_shop score between 10 and 20.

SQL Example

Code Block
linenumberstrue
select count(*) from (

...


select

...


a."cdp_customer_id"

...


from "cdp_audience_409"."customers" a

...


where (a."likely_to_shop" between 10 and 20)

...


-- set session distributed_join = 'true'

...


) cs

does not contain

Use the does not contain operator to match all profiles that do not contain the selected value.






does not contain

does not contain the selected value

include all profiles where the company does not contain Johnston LLC.

select count(*) from (
select
a."cdp_customer_id"
from "cdp_audience_409"."customers" a
where not coalesce(position('Johnston LLC' in a."company") > 0
-- set session distributed_join = 'true'
) cs

does not start with

does not begin with the selected value

include all profiles where company does not start with Johnston LLC

select count(*) from (
select
a."cdp_customer_id"
from "cdp_audience_409"."customers" a
where not coalesce(position('Johnston LLC' in a."company") = 1
-- set session distributed_join = 'true'
) cs

does not end with

does not end with the selected value

include all profiles where the last_name does not end with Saint John.

select count(*) from (
select
a."cdp_customer_id"
from "cdp_audience_409"."customers" a
where not coalesce(substr(a."last_name", -length('Saint John'), length('Saint John')) = 'Saint John'
-- set session distributed_join = 'true'
) cs

is one of

one of the selected options

include all profiles where the job_title is either 'VP Marketing' or 'VP sales' or 'VP Product Management'.

select count(*) from (
select
a."cdp_customer_id"
from "cdp_audience_409"."customers" a
where a."job_title" in ('VP Marketing','VP sales','VP Product Management')
-- set session distributed_join = 'true'
) cs

is not one of

not one of the selected options

include all profiles where the job_title is NOT Teacher or Physical Therapist or Chemical Engineer.

select count(*) from (
select
a."cdp_customer_id"
from "cdp_audience_409"."customers" a
where not coalesce(a."job_title" in ('Teacher','Physical Therapist','Chemical Engineer'), false)
-- set session distributed_join = 'true'
) cs

is not between

not between the selected values

include all profiles where the likely_to_shop_score is not between 31 and 40.

select count(*) from (
select
a."cdp_customer_id"
from "cdp_audience_409"."customers" a
where not coalesce((a."likely_to_shop_score" between 31 and 40), false)
-- set session distributed_join = 'true'
) cs

exists

where the selected attribute exists

match all profiles that have an affinity_sub_category score.

select count(*) from (
select
a."cdp_customer_id"
from "cdp_audience_409"."customers" a
where a."affinity_sub_category" is not null
-- set session distributed_join = 'true'
) cs

does not exist

does not exist

match all profiles that do not have a td_ip_city_postal_code value.

select count(*) from (
select
a."cdp_customer_id"
from "cdp_audience_409"."customers" a
where a."td_ip_city_postal_code" is null
-- set session distributed_join = 'true'
) cs

does not exist or greater than

does not exist or is greater than a certain value

match all profiles that do not have a td_ip_city_postal_code_value or have a td_ip_city_postal_code_valuegreater than 94119.

select count(*) from (
select
a."cdp_customer_id"
from "cdp_audience_409"."customers" a
where not coalesce(a."td_ip_city_postal_code" <= '94119', false)
-- set session distributed_join = 'true'
) cs

does not exist or greater than or equal to

does not exist or is greater than or equal to a certain value

match all profiles that do not have a td_ip_city_postal_code_value or have a td_ip_city_postal_code_valuegreater than or equal to 94119

select count(*) from (
select
a."cdp_customer_id"
from "cdp_audience_409"."customers" a
where not coalesce(a."td_ip_city_postal_code" < '94119', false)
-- set session distributed_join = 'true'
) cs

does not exist or less than

does not exist or is less than a certain value

match all profiles that do not have a td_ip_city_postal_code_value or have a td_ip_city_postal_code_value less than 94119

select count(*) from (
select
a."cdp_customer_id"
from "cdp_audience_409"."customers" a
where not coalesce(a."td_ip_city_postal_code" >= '94119', false)
-- set session distributed_join = 'true'
) cs

does not exist or less than or equal to

does not exist or is less than or equal to a certain value

match all profiles that do not have a td_ip_city_postal_code_value or have a td_ip_city_postal_code_value less than or equal to 94119.

select count(*) from (
select
a."cdp_customer_id"
from "cdp_audience_409"."customers" a
where not coalesce(a."td_ip_city_postal_code" > '94119', false)
-- set session distributed_join = 'true'
) cs

...