---
schema_version: "1"
id: 8bd9a48fcd933fc302292a5e15656366a4b8041589836ccfd12452ef6747a4dc
title: "Quick Start: Run Your First Query"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_sql/guides/bi-sql-quick-start.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-quick-start.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7118a93d208d36b36175c3c6e2e036201066ebf08532fee21862f125ebbf2e58
products:
  - SQL for Analytics Developer Guide
  - analytics
---

# Quick Start: Run Your First Query

Let’s write a basic query for SQL for CRM Analytics in Analytics Studio.

1.  In CRM Analytics Studio, open a Lens on a dataset.
2.  Click the **Query Mode** button.

    ![Query mode icon on a New Lens screen](https://developer.salesforce.com/docs/media/bi_dev_guide_sql/bi_sql_query_mode.png)

3.  SAQL is the default query language. To use SQL, click **Switch to SQL**.

    ![Switch to SQL in Query Mode](https://developer.salesforce.com/docs/media/bi_dev_guide_sql/bi_sql_query_switch.png)

4.  Switching to SQL provides a warning that switching clears your current query. If you don't want to lose the SAQL query, copy it. Then click **Switch to SQL**.

    ![Switch Query Mode modal](https://developer.salesforce.com/docs/media/bi_dev_guide_sql/bi_sql_query_modal.png)

    **note:** To return to SAQL query language, click the **Chart Mode** button, then click the **Query Mode** button. If you return to SAQL, you lose any SQL query changes that you made.

5.  The default query for SQL is the row count in your dataset. Let's update the query to count the number of times a category occurs for each city. To run the query, click the **Run Query** button. Because we limit the results to 10 rows, the results display the first 10 cities in the furniture category.

    ![Run SQL query](https://developer.salesforce.com/docs/media/bi_dev_guide_sql/bi_sql_run_query.png)

    ```nolang
    SELECT Category, City, count(*) as "count" FROM "Superstore"
    GROUP BY Category, City
    LIMIT 10;

    ```

    | Category  | City         | count |
    | --------- | ------------ | ----- |
    | Furniture | Akron        | 2     |
    |           | Alexandria   | 3     |
    |           | Allen        | 1     |
    |           | Allentown    | 1     |
    |           | Amarillo     | 4     |
    |           | Anaheim      | 8     |
    |           | Andover      | 1     |
    |           | Apopka       | 1     |
    |           | Apple Valley | 2     |
    |           | Arlington    | 13    |
