Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Query
    • Overview
    • Selecting data from all columns
    • Selecting data from specific columns
    • Sorting and filtering
    • Aggregating data
    • Additional selection criteria
    • Working with JSON
    • Running a streaming data query
  • Access management
  • Pricing policy
  • Integration
  • Audit Trails events
  • FAQ
  1. Working with YQL
  2. Aggregating data

Aggregating data

Written by
Yandex Cloud
Improved by
Max Z.
Updated at March 6, 2025

You can aggregate data results by fields.

For example:

  • Calculate the number of taxi rides.
  • Calculate the average tip amount.
  • Group by taxi pick-up location (PULocationID).
SELECT
    PULocationID,
    COUNT(*) AS rides_count,    -- The COUNT aggregation function returns the number of rows
                                -- returned by the query.
                                -- Asterisk (*) indicates that COUNT
                                -- will count the total number of rows in the table.
                                -- The function counts each row separately.
                                -- This includes rows that contain null values.
    AVG(tip_amount) AS avg_tip_amount
FROM
    `tutorial-analytics`
GROUP BY PULocationID           -- Column to aggregate the data by.

View the example in the right-hand section and click Run.
Query results are available in the Result tab as a table or schema.

See alsoSee also

  • SELECT.
  • GROUP BY.
  • Data aggregation function.

Was the article helpful?

Previous
Sorting and filtering
Next
Additional selection criteria
© 2025 Direct Cursus Technology L.L.C.