View query syntax

The View query language provides a SQL-like syntax for querying and retrieving data from your views. This page provides an overview of the language features and serves as an entry point to the detailed syntax documentation.

Overview

The View query language enables you to:

  • Select specific data fields or entire objects

  • Filter results based on conditions

  • Join data from multiple tables

  • Sort and limit results

  • Create hierarchical data structures

  • Paginate large result sets

Core query components

For the complete query structure and syntax, see Query.

Query structure

  • Query - Complete query structure and composition

  • SELECT - Specifying data to retrieve

  • FROM - Specifying the data source

  • WHERE - Filtering results

  • AS - Creating aliases

  • ORDER BY - Sorting results

  • GROUP BY - Grouping related data

  • JOIN - Combining data from multiple tables

Operators

Functions

Pagination

Example queries

Here are a few examples of common query patterns:

Basic query with filtering
SELECT * FROM products
WHERE category = 'Electronics' AND price < 500
ORDER BY price ASC
Query with pagination
SELECT * AS products, next_page_token() AS nextPageToken
FROM products
OFFSET page_token_offset(:pageToken)
LIMIT 10
Query with grouping and collection
SELECT category, collect(*) AS products
FROM products
GROUP BY category

Start with the Query reference for more examples and detailed syntax information.