Files
notion-sql/examples/aggregate_functions.md
james.maes fb10ae20c3 feat: Implement v1.0.0 release with comprehensive audit fixes
- Fix clippy warnings in test code by adding #[allow(dead_code)]
- Move all unit tests from source files to tests/ directory
- Add integration tests for SQL parsing and schema operations
- Create examples directory with 5 SQL query examples
- Add Windows CI job to ci.yml for cross-platform coverage
- Update Cargo.toml with documentation and readme fields
- Add comprehensive clean room audit documentation

All 39 tests passing, clippy clean, formatting verified
2026-06-02 13:12:50 -05:00

790 B

Aggregate Functions Example

This example shows how to use aggregate functions in your queries.

SELECT 
    Status,
    COUNT(*) as count,
    AVG(Rating) as average_rating
FROM Tasks 
GROUP BY Status;

This query:

  • Groups records by Status column
  • Counts the number of records in each status group
  • Calculates the average Rating for each status

Run with:

notion-sql query --database-id YOUR_DATABASE_ID --sql "SELECT Status, COUNT(*) as count, AVG(Rating) as average_rating FROM Tasks GROUP BY Status;"

Supported aggregate functions:

  • COUNT(*) - Count the number of records
  • SUM(column) - Sum values in a numeric column
  • AVG(column) - Calculate the average of a numeric column
  • MIN(column) - Find the minimum value
  • MAX(column) - Find the maximum value