The new Search Ads 360 Reporting API is now available. Join the
searchads-api-announcements Google group to stay up to date on upcoming enhancements and releases.
Query grammar reference
The table below contains a complete Search Ads 360 Query Language grammar
reference.
Grammar reference |
Query |
SELECT clause |
SELECT FIELD_NAME (, FIELD_NAME)* |
FROM clause |
FROM RESOURCE_NAME |
WHERE clause |
WHERE CONDITION (AND CONDITION)* |
ORDER BY clause |
ORDER BY ORDERING (, ORDERING)* |
LIMIT clause |
LIMIT POSITIVE_INTEGER |
PARAMETERS clause |
PARAMETERS LITERAL = VALUE (, LITERAL = VALUE)* |
|
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 | CONTAINS ALL | CONTAINS NONE | IS NULL | IS NOT NULL | DURING | BETWEEN | REGEXP_MATCH | NOT REGEXP_MATCH |
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 |
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 the LIKE
operator, surround
the character in square brackets. For example, the following condition matches
all campaign.name
values that start with [Earth_to_Mars]
:
WHERE campaign.name LIKE '[[]Earth[_]to[_]Mars[]]%'
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-09 UTC.
[null,null,["Last updated 2024-10-09 UTC."],[[["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`, and `PARAMETERS`."],["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."]]],[]]