Esta é a referência gramatical da linguagem de consulta do Google Ads (em notação de expressão regular):
Query -> SelectClause FromClause WhereClause? OrderByClause?
LimitClause? ParametersClause?
SelectClause -> SELECT FieldName (, FieldName)*
FromClause -> FROM ResourceName
WhereClause -> WHERE Condition (AND Condition)*
OrderByClause -> ORDER BY Ordering (, Ordering)*
LimitClause -> LIMIT PositiveInteger
ParametersClause -> PARAMETERS Literal = Value (, Literal = Value)*
Condition -> FieldName Operator Value
Operator -> = | != | > | >= | < | <= | IN | NOT IN |
LIKE | NOT LIKE | CONTAINS ANY | CONTAINS ALL |
CONTAINS NONE | IS NULL | IS NOT NULL | DURING |
BETWEEN | REGEXP_MATCH | NOT REGEXP_MATCH
Value -> Literal | LiteralList | Number | NumberList | String |
StringList | Function
Ordering -> FieldName (ASC | DESC)?
FieldName -> [a-z] ([a-zA-Z0-9._])*
ResourceName -> [a-z] ([a-zA-Z_])*
StringList -> ( String (, String)* )
LiteralList -> ( Literal (, Literal)* )
NumberList -> ( Number (, Number)* )
PositiveInteger -> [1-9] ([0-9])*
Number -> -? [0-9]+ (. [0-9] [0-9]*)?
String -> (' Char* ') | (" Char* ")
Literal -> [a-zA-Z0-9_]*
Function -> LAST_14_DAYS | LAST_30_DAYS | LAST_7_DAYS |
LAST_BUSINESS_WEEK | LAST_MONTH | LAST_WEEK_MON_SUN |
LAST_WEEK_SUN_SAT | THIS_MONTH | THIS_WEEK_MON_TODAY |
THIS_WEEK_SUN_TODAY | TODAY | YESTERDAY
?indica um elemento opcional * significa zero ou mais; + significa um ou mais (xxxxxx) indica um agrupamento [a-z0-9] significa intervalos de caracteres | significa "ou"
Para corresponder a um [, ], % ou _ literal usando o operador LIKE, envolva
o caractere entre colchetes. Por exemplo, a condição a seguir corresponde
todos os valores campaign.name que começam com [Earth_to_Mars]:
campaign.name LIKE '[[]Earth[_]to[_]Mars[]]%'
O operador LIKE só pode ser usado em um campo de string, não em uma matriz.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2024-08-21 UTC."],[[["Google Ads Query Language (GAQL) uses a specific syntax to construct queries for retrieving data from Google Ads accounts, similar to SQL."],["GAQL supports various clauses like `SELECT`, `FROM`, `WHERE`, `ORDER BY`, `LIMIT`, and `PARAMETERS` for data manipulation."],["The `WHERE` clause allows filtering data based on conditions using operators like `=`, `!=`, `\u003e`, `\u003c`, `IN`, `LIKE`, `CONTAINS`, and others."],["GAQL provides built-in functions such as `LAST_14_DAYS`, `THIS_MONTH`, `TODAY`, etc., for convenient date range selection within queries."],["When using operators like `LIKE`, special characters need to be escaped with square brackets for literal matching."]]],[]]