# GAQL: Google Ads Query Language, Now Written by AI

What GAQL is, how a query is built, where it differs from SQL, and how to sanity-check queries an AI writes against your account.

Glossary · Published 2026-08-10.

> GAQL (Google Ads Query Language) is the query language of the Google Ads API — every report the API returns is the result of a GAQL query selecting fields from one resource, filtered with WHERE clauses. It looks like SQL and is not: no joins, no GROUP BY, segmentation through named segments, money in micros. In 2026 the working skill is sanity-checking GAQL an AI wrote, not writing it by hand.

GAQL — Google Ads Query Language — is the language every Google Ads API report is written in. One statement — `SELECT` fields `FROM` one resource, with optional `WHERE`, `ORDER BY` and `LIMIT` — describes exactly which columns, rows and date range come back. The Google Ads UI builds these queries behind its screens; the API makes you, or your AI, write them. And that is the honest 2026 update: you no longer need to write GAQL. You need to read enough of it to check what an AI wrote for you.

## How a GAQL query is built

A representative query:

```sql
SELECT
  search_term_view.search_term,
  metrics.cost_micros,
  metrics.conversions
FROM search_term_view
WHERE segments.date DURING LAST_30_DAYS
ORDER BY metrics.cost_micros DESC
LIMIT 50
```

Four parts, four jobs. `FROM` names exactly one resource — the table-like view the query runs against: `campaign`, `ad_group`, `keyword_view`, `search_term_view`, `change_event`. `SELECT` names fields of that resource, plus `metrics.*` (the numbers) and `segments.*` (the slicers, such as date or device). `WHERE` filters — and carries the date range. `ORDER BY` and `LIMIT` shape the output. Selecting a segment splits rows by it: add `segments.device` and each campaign comes back as one row per device.

Money needs one reflex: the API returns cost in micros — millionths of the currency unit. A `cost_micros` of 12,500,000 is 12.50 in account currency. Every sane tool divides before showing you, and an undivided micros column is the first thing to suspect when a number looks absurdly large.

## GAQL vs SQL: the differences that trip people up

- **No JOINs.** One resource per query; relationships are pre-baked into the resources themselves, which is why views like `keyword_view` exist at all.
- **No GROUP BY.** Aggregation is implicit in the resource; slicing happens by selecting segments, not by grouping.
- **No SELECT-star.** Every field is named explicitly — verbose, but self-documenting.
- **Dates are special.** `DURING LAST_30_DAYS`, or `BETWEEN` two ISO dates — the range lives in WHERE, and getting it wrong quietly answers a different question than you asked.
- **Zeros need asking for.** Whether entities with no impressions appear depends on the resource and filters — a "missing" keyword is usually a filtered keyword, not a deleted one.

## Five useful queries, written as plain-English prompts

With a connected account, prompts do the writing — a [Google Ads MCP server](https://adcopilot.cloud/google-ads-mcp-server) exposes the query tool and the AI fills in the GAQL:

1. "Search terms with spend and zero conversions, last 30 days, worst first" — the waste finder, straight into [search terms report](https://adcopilot.cloud/glossary/search-terms-report) territory.
2. "Campaign spend, conversions and conversion value by week, last eight weeks" — the trend baseline.
3. "Keywords whose Quality Score components are below average, with their spend" — the diagnostic pull.
4. "Everything that changed in this account in the last 14 days" — `change_event`, the audit view.
5. "Conversion rate by device per campaign, this quarter" — the segment slice.

More where these came from in the [prompt library](https://adcopilot.cloud/blog/chatgpt-prompts-for-google-ads).

## Four checks on a query an AI wrote

An AI writes GAQL fluently and fast — and like any fluent writer, it can be confidently wrong in quiet ways. Four checks catch nearly everything:

- **The date range.** Is `WHERE segments.date` the period you asked about? A defaulted or shifted range is the commonest silent error.
- **Micros.** Confirm the division happened; a figure a million-fold off is an undivided `cost_micros`.
- **The resource.** Search terms come from `search_term_view`, not `keyword_view` — the answer changes with the FROM.
- **Zeros and filters.** Before believing an entity vanished, ask what filtered it.

The queries are no longer the skill. The verification reflex is — and it takes ten seconds per query, which is a fair price for acting on numbers you trust.

## Questions

### Do I need to learn GAQL to use an AI connector?

No. You prompt in plain English — 'search terms with cost and no conversions, last 30 days' — and the AI writes and runs the query. What repays learning is reading: knowing that FROM names the resource, WHERE holds the date range, and cost arrives in micros lets you verify in ten seconds that the numbers you are about to act on came from the query you meant.

### Where can I test a GAQL query directly?

Google's interactive Query Builder in the Google Ads API documentation lets you assemble queries field by field and validates combinations as you go. Developers can run queries through the API's search endpoints or the official client libraries. If an AI-written query looks suspicious, pasting it into the query builder is the fastest neutral referee.

---

This is the markdown copy of https://adcopilot.cloud/glossary/gaql-google-ads-query-language. The index of the site's pages is https://adcopilot.cloud/llms.txt.
