AI-generated Key Takeaways
-
This document provides a comprehensive grammar reference for the Search Ads 360 Query Language.
-
The language allows users to query data using a structured syntax including clauses like
SELECT
,FROM
,WHERE
,ORDER BY
,LIMIT
, andPARAMETERS
. -
Various data types like numbers, strings, and lists are supported within the query structure for filtering and data retrieval.
-
Specific operators and functions enable detailed data manipulation, such as date ranges (
LAST_30_DAYS
) and pattern matching (REGEXP_MATCH
). -
The provided table details the syntax and components of the query language, along with explanations of special characters and usage examples.
The table below contains a complete Search Ads 360 Query Language grammar reference.
Grammar reference | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Query |
|
||||||||||||
Field name | [a-z] ([a-zA-Z0-9._])* |
||||||||||||
Resource name | [a-z] ([a-zA-Z_])* |
||||||||||||
Condition | FIELD_NAME OPERATOR VALUE |
||||||||||||
Ordering | FIELD_NAME (ASC | DESC)? |
||||||||||||
Operator | = | != | > | >= | < | <= | IN | NOT IN | LIKE | NOT LIKE | CONTAINS ANY | |
||||||||||||
Function | LAST_14_DAYS | LAST_30_DAYS | LAST_7_DAYS | LAST_BUSINESS_WEEK | LAST_MONTH | |
||||||||||||
Value | LITERAL | LITERAL_LIST | NUMBER | NUMBER_LIST | STRING | STRING_LIST | FUNCTION |
||||||||||||
Positive integer | [1-9] ([0-9])* |
||||||||||||
Number | -? [0-9]+ (. [0-9] [0-9]*)? |
||||||||||||
String | (' Char* ') | (" Char* ") |
||||||||||||
Literal | [a-zA-Z0-9_]* |
||||||||||||
String list | ( STRING (, STRING)* ) |
||||||||||||
Literal list | ( LITERAL (, LITERAL)* ) |
||||||||||||
Number list | ( NUMBER (, NUMBER)* ) |
Key:
?
indicates an optional element.*
means zero or more+
means one or more.(xxxxxx)
indicates a grouping.[a-z0-9]
indicates a character range.Char
indicates any character.|
stands for "or".- The
REGEXP_MATCH
operator uses RE2 syntax. To match a
[
,]
,%
, or_
literal using theLIKE
operator, surround the character in square brackets. For example, the following condition matches allcampaign.name
values that start with[Earth_to_Mars]
:WHERE campaign.name LIKE '[[]Earth[_]to[_]Mars[]]%'