Use ShopifyQL to query the GraphQL Admin API for segmentation data. Segmentation data represents data subsets, which users have created according to some criteria. Segmentation data corresponds to saved search queries in the Shopify admin. For example, a user can save a segment for customers that are subscribed to email marketing. These customers are the segment members. The following guide explains the syntax for forming queries. > Note: > Segment queries don't support all ShopifyQL syntax. ## Segment queries Segmentation queries in API requests are precise definitions of segments. The queries indicate the condition or conditions that data must satisfy to be selected. The syntax performs a similar function to `WHERE` statements in SQL. Query syntax acts as a filter to determine the data returned. For example, a segment query can retrieve segment members that have left a checkout without completing their purchase in the last 30 days. You can query a maximum of 250 segments. The maximum value that `first` and `last` arguments accept is `250`. ## Query syntax Segment queries are composed of a clause, or multiple clauses, specifying facts about the segment. The clauses specify a segment by applying a condition to an attribute using an operator. An individual clause consists of the following components: - `<attribute>`: The properties that define all items in a specific category. - `<operator>`: A reserved character pattern that performs tasks such as comparisons and arithmetic operations. - `<condition>`: The state required for data to be either selected or filtered out. ## Clause format The following is the query clause format: ```sql <clause> ::= <attribute> <operator> <condition> ``` For example, in the following clause, `email_subscription_status` is the attribute, `=` is the operator, and `SUBSCRIBED` is the condition: <p> <div class="react-code-block" data-preset="file"> <div class="react-code-block-preload ThemeMode-dim"> <div class="react-code-block-preload-bar "></div> <div class="react-code-block-preload-placeholder-container"> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> </div> </div> <script data-option="filename" data-value="Segment query example"></script> <script type="text/plain" data-language="sql"> email_subscription_status = 'SUBSCRIBED' </script> </div> </p>  You can also [group clauses](/docs/api/shopifyql/segment-query-language-reference#grouped-clauses). ## Attributes An attribute's data type determines the valid operators and conditions for defining segment queries. The following are supported attributes and their data types: <table> <caption>Attribute data types</caption> <tr> <th scope="col">Attribute</th> <th scope="col">Data type</th> <th scope="col">Description</th> </tr> <tr> <td><code>abandoned_checkout_date</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#date-attributes">Date</a></td> <td>The date of the customer's abandoned checkout.</a> </tr> <tr> <td><code>anniversary()</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#function-attributes">Function</a></td> <td>The customer with a yearly recurring date, such as a birth date.</td> </tr> <tr> <td><code>amount_spent</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#float-attributes">Float</a></td> <td>The total amount spent (all time).</td> </tr> </tr> <tr> <td><code>companies</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#integer-attributes">Integer</a></td> <td>The company ID for which the customer is configured as B2B contact.</td> </tr> <tr> <td><code>created_by_app_id</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#integer-attributes">Integer</a></td> <td>The app ID that created the customer.</td> </tr> <tr> <td><code>customer_account_status</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#enum-attributes">Enum</a></td> <td>The customer's account status.</td> </tr> <tr> <td><code>customer_added_date</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#date-attributes">Date</a></td> <td>The date when the customer was added on Shopify.</td> </tr> <tr> <td><code>customer_cities</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#enum-attributes">Enum</a></td> <td>The customer's city.</td> </tr> <tr> <td><code>customer_countries</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#enum-attributes">Enum</a></td> <td>The customer's country or region (shipping/billing).</td> </tr> <tr> <td><code>customer_email_domain</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#string-attributes">String</a></td> <td>The customer's email domains.</td> </tr> <tr> <td><code>customer_language</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#string-attributes">String</a></td> <td>The customer's language.</td> </tr> <tr> <td><code>customer_regions</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#enum-attributes">Enum</a></td> <td>The customer's region.</td> </tr> <tr> <td><code>customer_tags</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#string-attributes">String</a></td> <td><p>The customer's assigned tags.</p><p>Tag existence isn't validated.</p></td> </tr> <tr> <td><code>customer_within_distance</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#function-attributes">Function</a></td> <td>The customer with an address within a specified distance of a particular latitude, longitude.</td> </tr> <tr> <td><code>email_subscription_status</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#enum-attributes">Enum</a></td> <td>The customer's email subscription status.</td> </tr> <tr> <td><code>first_order_date</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#date-attributes">Date</a></td> <td>The date of the customer's first order.</td> </tr> <tr> <td><code>last_order_date</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#date-attributes">Date</a></td> <td>The date of the customer's last order.</td> </tr> <tr> <td><code>number_of_orders</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#integer-attributes">Integer</a></td> <td>The number of orders for the customer (all time).</td> </tr> <tr> <td><code>orders_placed</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#function-attributes">Function</td> <td>The orders that the customer placed (all time).</td> </tr> <tr> <td><code>predicted_spend_tier</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#enum-attributes">Enum</a></td> <td>The customer's predicted spend tier.</td> </tr> <tr> <td><code>products_purchased</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#function-attributes">Function</td> <td>The products that the customer purchased (all time).</td> </tr> <tr> <td><code>product_subscription_status</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#enum-attributes">Enum</a></td> <td>The customer's status for product subscriptions.</td> </tr> <tr> <td><code>rfm_group</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#enum-attributes">Enum</a></td> <td>The customer's RFM group.</td> </tr> <tr> <td><code>sms_subscription_status</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#enum-attributes">Enum</a></td> <td>The customer's status for SMS subscriptions.</td> </tr> <tr> <td><code>shopify_email.bounced</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#function-attributes">Function</a></td> <td>The customer whose email was returned to the server that sent it.</td> </tr> <tr> <td><code>shopify_email.clicked</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#function-attributes">Function</a></td> <td>The customer who clicked on any link or image in the email.</td> </tr> <tr> <td><code>shopify_email.delivered</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#function-attributes">Function</a></td> <td>The customer for whom the server has accepted an email.</td> </tr> <tr> <td><code>shopify_email.marked_as_spam</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#function-attributes">Function</a></td> <td>The customer who reported an email using its mail client’s “Mark as Spam”, “Report”, or “Junk” feature.</td> </tr> <tr> <td><code>shopify_email.opened</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#function-attributes">Function</a></td> <td>The customer who opened an email on their email client.</td> </tr> <tr> <td><code>shopify_email.unsubscribed</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#function-attributes">Function</a></td> <td>The customer who requested removal from the organization's email address list and can no longer be mailed.</td> </tr> <tr> <td><code>store_credit_accounts</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#function-attributes">Function</a></td> <td>The customer who has store credit accounts.</td> </tr> <tr> <td><code>storefront_event.collection_viewed</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#function-attributes">Function</a></td> <td>The customer who browsed a particular product collection.</td> </tr> <tr> <td><code>storefront_event.product_viewed</code></td> <td><a href="/docs/api/shopifyql/segment-query-language-reference#function-attributes">Function</a></td> <td>The customer who browsed a particular product.</td> </tr> </table> ### Boolean attributes Boolean attributes support specific operators and conditions. > Note: > The Segmentation API doesn't currently include Boolean-type attributes. #### Operators |Operator|Description|Example| |---------|---------|------------| | `=` | Is | `boolean_attribute = true`| | `!=` | Is not | `boolean_attribute != true`| #### Conditions |Condition|Description|Example| |---------|---------|------------| | `true` | True | `boolean_attribute = true` | | `false` | False | `boolean_attribute = false`| ### Date attributes Date attributes support specific operators and conditions. #### Operators Date operators act on complete 24-hour days and default to a shop's time zone. For example, a New York shop (GMT-4) with the following query would include customers who last ordered between midnight (`T00:00:00`) on May 30th, 2020 to midnight on May 31st, 2020 in the shop's timezone. ```sql last_order_date = 2020-05-30 ``` In SQL, with UTC-based times, this would look like the following: ```sql last_order_date >= 2020-05-30T04:00:00 AND last_order_date < 2020-05-31T04:00:00 ``` The following segment query would include customers who last ordered from midnight on May 31st: ```sql last_order_date > 2020-05-30 ``` The following are supported operators for date-type attributes. |Operators|Description|Examples| |---------|---------|------------| | `=` | Equal-to | `last_order_date = 2020-05-30` | | `!=`| Not-equal-to | `last_order_date != 2020-05-30` | | `>` | After | `last_order_date > 2020-05-30` | | `>=` | On or after | `last_order_date >= 2020-05-30` | | `<` | Before | `last_order_date < 2020-05-30` | | `<=` | On or before | `last_order_date <= 2020-05-30` | | `BETWEEN {condition1} AND {condition2}` | Equivalent to `condition1 <= n <= condition2` | `BETWEEN 2020-02-30 AND 2020-03-30` | #### Conditions Date-type attributes accept specific conditions. ##### `{absoluteDate}` Language-sensitive formatted dates aren't accepted. |Format| Examples| |---------|---------| | `yyyy-mm-dd` | Represents an absolute date __without time__ | `last_order_date = 2020-05-30` <br /> `last_order_date > 2020-05-30` <br /> `last_order_date < 2020-05-30` <br /> `last_order_date != 2020-05-30` | ##### `{dateOffset}` Syntactic sugar for an absolute date without time. For example, if the date is `May 15th 2021`, then `-7d` is syntactic sugar for `2021-05-07`. The following are examples of `{dateOffset}`: |Format|Description|Examples| |------|---------|------------| | `{+/-} {#} d` | Number of days | `last_order_date > -7d` | | `{+/-} {#} w` | Number of weeks | `last_order_date >= -2w` | | `{+/-} {#} m` | Number of months | `last_order_date = -1m` | | `{+/-} {#} y` | Number of years | `last_order_date < -1y` | ##### `{namedDate}` Syntactic sugar for an absolute date without time. `{namedDate}` supports the following operators: ```sql =, !=, >, >=, <, <=, BETWEEN ``` When using the `BETWEEN` operator, condition types can be mixed. ```sql last_order_date BETWEEN 2021-01-01 AND today ``` ```sql last_order_date BETWEEN 2020-01-01 AND -7d ``` |Format|Description|Examples| |------|---------|------------| | `today`| Date when the query is run or segment is queried | `last_order_date = today`| | `yesterday` | Previous day | `last_order_date = yesterday`| The `-12m`, `-90d`, `-30d`, and `-7d` standard syntax is preferred to the now-deprecated `12_months_ago`, `90_days_ago`, `30_days_ago`, and `7_days_ago` syntax. ##### `{absoluteDateTime}` In some cases, users might want finer segment granularity, such as the segment of customers that participated in a timed flash sale. The segmentation query syntax supports an absolute datetime in place of an absolute date. > Note: > Assistive features for adding a time component aren't supported. Users are required to type these out manually. |Format|Description|Examples| |---------|---------|------------| | `yyyy-mm-ddTHH:mm:ss` | Represents an absolute date with time in the shop's timezone | `last_order_date > 2020-05-30T16:00:00` | Times default to a shop's timezone. For example, a New York shop (GMT-4) with the following query would include customers means `last_order_date > 2020-05-30T20:00:00` in UTC. #### Notes - Only 24h format is supported. For example, `HH` needs to be be <= 23 (24h = `00:00:00`). - Leading zeros are required, for example, `23:00:00`. - Time-only syntax is not supported. For example, the following syntax is invalid: ```sql last_order_date BETWEEN 1pm AND 3pm ``` - You can't extend `{namedDate}` or `{dateOffset}` with a time-specifier. ### Enum attributes `Enum` attributes support specific operators and conditions. #### Operators |Operators|Description|Example| |---------|---------|------------| | `=` | Equal-to | `customer_account_status = 'DISABLED'` | | `!=` | Not-equal-to | `customer_account_status != 'DISABLED'` | #### Conditions - Conditions accept UTF-8 characters and must be wrapped with single quotes `'`, similar to the [`ENUM` type in MySQL](https://dev.mysql.com/doc/refman/8.0/en/enum.html). - Conditions only accept a value chosen from a list of permitted values. - Conditions are case-sensitive and whitespaces are syntactically significant. - Single quotes within a condition must be escaped (ie. `'\'VIP\''`). - For Segmentation, we're using multiple clauses with connectors to specify multiple values. ### Float attributes `Float` attributes support specific operators and conditions. The underlying data type is a `float64` (double-precision floating-point format). #### Operators |Operators|Description|Example| |---------|---------|------------| | `=` | Equal-to | `amount_spent = 10.99`| | `!=` | Not-equal-to | `amount_spent != 10.99`| | `>` | Greater than | `amount_spent > 10.99`| | `>=` | Greater than or equal to | `amount_spent >= 10.99`| | `<` | Less than | `amount_spent < 10.99`| | `<=` | Less than or equal to | `amount_spent <= 10.99`| | `BETWEEN {value1} AND {value2}` | Equivalent to `value1 <= n <= value2` | `amount_spent BETWEEN 100 AND 1000.99`| #### Conditions - Conditions accept float (`float64`) and integer numbers. - Integers automatically get converted to floating point (ie. `99` => `99.0`). - Operators and functions returning a `Float`, for example `COUNT`, `SUM`, `MAX`, and `MEDIAN`, aren't supported for querying segments. ##### Formatting and separators - A decimal point (`.`) is used as a decimal separator, by default. - Thousand separators, such as commas and spaces, aren't supported. - Language-sensitive formatted numbers aren't supported. ### Function attributes A `Function` accepts 0 or more parameters, individually supporting specific `<operator>`s and `<condition>`s that you can use to select specific customers. For example, `products_purchased MATCHES (id = 1234, count > 1)` would select all customers who purchased product id 1234 more than once. #### Syntax - Function names accept the same characters as regular filters, using lowercase alphanumerical and underscore (`snake_case()`). - Functions names are follow by either `MATCHES` or `NOT MATCHES` and parentheses enclosing the list of optional parameters. - Parameters are expressed by name with an appropriate, typed operator and value. - The previous syntax is now deprecated syntax (for example, `products_purchased (id: 1234) = true). - The `anniversary` expression is a modifier for a date filter, not a function. It determines whether a specified date falls on the annual anniversary of another data. For example, `anniversary ('metafields.facts.birth_date') = today`. #### Support The segmentation query syntax has limited support for function-type attributes. ### `products_purchased` This function returns a `Boolean`. Supported `<operator>` values are `=` and `!=`. For example, ```sql products_purchased NOT MATCHES () products_purchased MATCHES (id = 2012162031638) products_purchased MATCHES (tag = 'Sports wear') products_purchased MATCHES (id IN (2012162031638, 1012132033639)) ``` #### Named parameters ##### `id` (optional) ```sql products_purchased MATCHES (id = ID | id IN List<ID>) ``` Where `ID` is a single value and `List<ID>` is a set of comma-separated values wrapped in parenthesis. An implicit `OR` between values is applied for lists. Each ID is a product ID. ###### Notes - A single value in a list is valid. - Multiple values must be provided as a list. For example `(1012132033639, 2012162031638, 32421429314657)`. - A list can contain up to 500 IDs. For example, ```sql products_purchased MATCHES (id = 1012132033639) products_purchased MATCHES (id IN (1012132033639, 2012162031638, 32421429314657)) products_purchased MATCHES (id NOT IN (1012132033639)) ``` Omitting the `id` parameter returns results for all products. ##### `tag` (optional) ```sql products_purchased MATCHES (tag = String) ``` Where `tag` is a product tag. ###### Notes - A single tag can be provided. For example, ```sql products_purchased MATCHES (tag = 'Sports wear') ``` ##### `date` (optional) ```sql products_purchased MATCHES (date = Date?) ``` Where ```sql -- (inclusive) Date = {absoluteDate} | {dateOffset} | {namedDate} | BETWEEN {date} AND {date} ``` This parameter is the date when the product was purchased. For example, ```sql products_purchased MATCHES (id = 1012132033639, date = 2022-01-01) products_purchased NOT MATCHES (date > -3m) products_purchased MATCHES (tag = 'Sports wear', date >= -12m) products_purchased MATCHES (id = 1012132033639, date BETWEEN -12m AND today) ``` Omitting the `date` parameter returns results from all time. ### `shopify_email.EVENT()` Shopify Email functions enable segmenting on Shopify Email events. They are namespaced under the `shopify_email.` prefix. The following events are supported: - `bounced` - `clicked` - `delivered` - `marked_as_spam` - `opened` - `unsubscribed` All of these functions accept the same named parameters and return a `Boolean`. For example, ```sql shopify_email.opened MATCHES () shopify_email.opened MATCHES (activity_id = 5240029206) shopify_email.opened NOT MATCHES (activity_id = 5240029206) ``` #### Named parameters ##### `activity_id` (optional) ```sql shopify_email.EVENT MATCHES (activity_id = ID | activity_id IN List<ID>) ``` Where `ID` is a single value and `List<ID>` is a set of comma-separated values wrapped in parenthesis. An implicit `OR` between values is applied for lists. Each ID is a marketing activity ID to filter on. ###### Notes - A single value in a list is valid. - Multiple values must be provided as a list. For example `(5240029206, 1932881090, 3250045832)`. - A list can contain up to 500 IDs. For example, ```sql shopify_email.delivered MATCHES (activity_id = 5240029206) shopify_email.opened MATCHES (activity_id IN (5240029206, 1932881090, 3250045832)) shopify_email.unsubscribed MATCHES (activity_id IN (5240029206)) ``` Omitting the `activity_id` parameter returns results for all Shopify Email activities. ##### `date` (optional) ```sql shopify_email.EVENT(date = Date?) ``` Where ```sql -- (inclusive) Date = {absoluteDate} | {dateOffset} | {namedDate} | BETWEEN {date} AND {date} ``` This parameter is the date for the Shopify Email event. For example, ```sql shopify_email.delivered MATCHES (activity_id = 5240029206, date = 2022-01-01) shopify_email.marked_as_spam MATCHES (activity_id = 5240029206, date > -3m) shopify_email.bounced NOT MATCHES (activity_id = 5240029206, date BETWEEN -12m AND today) ``` Omitting the `date` parameter returns results from all time. ### Integer attributes `Integer` attributes are `int64` types that support specific operators and conditions. #### Operators |Operators|Description|Example| |---------|---------|------------|-----------|-------| | `=` | Equal-to | `number_of_orders = 10`| | `!=` | Not-equal-to | `number_of_orders != 10`| | `>` | Greater than | `number_of_orders > 10`| | `>=` | Greater than or equal to | `number_of_orders >= 10`| | `<` | Less than | `number_of_orders < 10`| | `<=` | Less than or equal to | `number_of_orders <= 10`| | `BETWEEN {value1} AND {value2}`| Equivalent to `value1 <= n <= value2` | `number_of_orders BETWEEN 100 AND 1000`| #### Conditions - Conditions accept only integer numbers. - Floats aren't valid. - Minimum value of `-9,223,372,036,854,775,808`. - Maximum value of `9,223,372,036,854,775,807`, inclusive. - Operators and functions returning a `Float`, for example `COUNT`, `SUM`, `MAX`, and `MEDIAN`, aren't supported for querying segments. ##### Formatting and separators - Thousand separators, such as commas and spaces, aren't supported. - Language-sensitive formatted numbers aren't supported. ### List attributes List attributes represent multi-value attributes. The values in the list have a type. The arguments the operator admits will depend on the type of the values within the list. An example is `customer_tags`, which is a multi-value list of strings. Its full type is therefore `List<String>`. Lists support the following operators and conditions. #### Operators |Operators|Description|Example| |---------|---------|------------| | `CONTAINS` | Allows you to specify a single value in a `WHERE` clause. The clause is `true` if the value matches an entry in the preceding list attribute. | `customer_tags CONTAINS 'vip'` <br /><br /> `customer_cities CONTAINS 'US-CA-LosAngeles'` | | `NOT CONTAINS` | True complement of `CONTAINS`. The clause is `true` if the value does not match an entry in the preceding list attribute. | `customer_tags NOT CONTAINS 'vip'` <br /><br /> `customer_cities NOT CONTAINS 'US-CA-LosAngeles'`| #### Conditions - The semantics of `CONTAINS` as applied to a `LIST` is that the arguments must be a subset of the preceding list attribute. - Segmentation queries currently use multiple clauses with connectors to specify multiple values, rather than a multi-argument form. ##### `List<String>` conditions - `String` conditions accept UTF-8 characters and must be wrapped with single quotes `'`, similar to the [`ENUM` type in MySQL](https://dev.mysql.com/doc/refman/8.0/en/enum.html). - Conditions are NOT case-sensitive and whitespaces are syntactically significant. - Single quotes within a condition must be escaped (ie. `'\'VIP\''`). ##### `List<ID>` conditions - ID is an alias for an unsigned integer. The underlying data type is a `uint64`. - Conditions don't have to be wrapped in single quotes `'`. ### String attributes String attributes support specific operators and conditions. #### Operators |Operators|Description|Example| |---------|---------|------------| | `=` | Equal-to | `customer_email_domain = 'example.com'` | | `!=` | Not-equal-to | `customer_email_domain != 'example.com'` | #### Conditions - Conditions accept UTF-8 characters and must be wrapped around single quotes `'`. - Conditions are case-sensitive and whitespaces are syntactically significant. - Single quotes within a condition must be escaped. For example, `'\'VIP\''`). - Conditions can be empty strings. The API verifies that the attribute exists and is an empty string. - All operators/functions returning a `String`, such as `CONCAT`, `SUBSTR`, `LOWER`, `UPPER`, and `TRUNCATE`, are not supported for querying segments. ### Grouped clauses The following are syntax examples of grouped clauses. #### Multiple clauses with same connector(s) **Two clauses linked with `AND`** ```sql email_subscription_status = 'SUBSCRIBED' AND customer_countries CONTAINS 'CA' ``` **Two clauses linked with `OR`** ```sql email_subscription_status = 'SUBSCRIBED' OR customer_countries CONTAINS 'CA' ``` **Invalid query: Too many clauses (>10)** ```sql customer_countries CONTAINS 'CA' OR customer_countries CONTAINS 'FR' OR customer_countries CONTAINS 'MX' OR customer_countries CONTAINS 'AU' OR customer_countries CONTAINS 'AX' OR customer_countries CONTAINS 'AZ' OR customer_countries CONTAINS 'FI' OR customer_countries CONTAINS 'BE' OR customer_countries CONTAINS 'TH' OR customer_countries CONTAINS 'ES' OR customer_countries CONTAINS 'BR' ``` #### Multiple clauses with different connectors By default `AND` takes precedence over `OR`. Parenthesis are optional. For example, the following queries are equivalent. ```sql email_subscription_status = 'SUBSCRIBED' AND customer_countries CONTAINS 'CA' OR amount_spent > 999.99 ``` ```sql (email_subscription_status = 'SUBSCRIBED' AND customer_countries CONTAINS 'CA') OR amount_spent > 999.99 ``` **Change implicit order of precedence: `OR` now takes precedence over `AND`** ```sql email_subscription_status = 'SUBSCRIBED' AND (customer_countries CONTAINS 'CA' OR amount_spent > 999.99) ```