---
schema_version: "1"
id: 99e5a0aa9bdf8d21425a2a2be6058109777a96c1f4598e75dc61adde1c66f51e
title: SAQL Statements
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_saql/guides/concept/bi-saql-statements-concept.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-statements-concept.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 9f650a31d2223f0d1eb4134445ee6ae0576f21e138b700e6174df699838cb1a1
products:
  - Analytics SAQL Developer Guide
  - analytics
---

# SAQL Statements

A query is made up of statements. Each SAQL statement has an input stream, an operation, and an output stream.

- **[arimax](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-arimax.md)**


    Uses existing data to predict future data points. The `arimax` statement must follow a projection statement in your query. Perform any filtering pre-projection or after the `arimax` statement.

- **[cogroup](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-cogroup.md)**


    Use `cogroup` to blend data from two or more data streams into a single data stream. The data streams must have at least one common field.

- **[fill](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-fill.md)**


    Use `fill()` to fill in any gaps in date fields. You most often use `fill()` before using the `timeseries` statement. By specifying the date fields to check, `fill()` creates a row that contains the missing month, day, week, quarter, or year and includes a null value. To include values outside the bounds of your data’s date range, specify a start date and end date to override existing limits. The function returns the missing date rows with null values.

- **[filter](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-filter.md)**


    Selects rows from a dataset based on a filter predicate.

- **[foreach](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-foreach.md)**


    Applies a set of expressions to every row in a dataset. This action is often referred to as *projection*.

- **[group-by](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-groupby.md)**


    Organizes the rows returned from a query into groups. Within each group, you can apply an aggregate function, such as `count()` or `sum()` to get the number of items or sum, respectively.

- **[group-by rollup](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-groupby-rollup.md)**


    `rollup` is a subclause of `group-by` that creates and displays aggregations of grouped data. The output of `rollup` is based on column order in your query.

- **[join semi and anti](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-join-semi-anti.md)**


    Use the `join` statement with the `join_type` to create semi-join or anti-join results.

- **[limit](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-limit.md)**


    Limits the number of results that are returned. If you don’t set a limit, queries return a maximum of 10,000 rows.

- **[load](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-load.md)**


    Loads a dataset. All SAQL queries start with a `load` statement.

- **[offset](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-offset.md)**


    Use `offset` to page through the results of your query.

- **[order](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-order.md)**


    Sorts in ascending or descending order on one or more fields.

- **[sample](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-sample.md)**


    Returns a random sample from a large dataset, where each data point has an equal probability of being selected. This keyword uses the Bernoulli distribution.

- **[timeseries](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-timeseries.md)**


    Uses existing data to predict future data points. The `timeseries` statement must follow a projection statement in your query. Perform any filtering pre-projection or after the `timeseries` statement.

- **[union](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-union.md)**


    Combines multiple result sets into one result set. The result sets must have the same field names and structure. You can use a different dataset to create each result set, or you can use the same dataset.
