ArangoDB Aggregation Query

ArangoDB is a Multi-model database that supports multiple aggregate queries. The following are some common aggregation query operations and corresponding implementation examples. 1. COUNT: Calculate the number of documents. SELECT COUNT(*) FROM collection_name 2. SUM: Sums the values of the specified fields. SELECT SUM(field_name) FROM collection_name 3. AVG: Calculate the average value of the specified field. SELECT AVG(field_name) FROM collection_name 4. MIN: Finds the minimum value of the specified field. SELECT MIN(field_name) FROM collection_name 5. MAX: Finds the maximum value of the specified field. SELECT MAX(field_name) FROM collection_name 6. GROUP BY: Group documents according to specified fields and perform aggregation operations. SELECT field_name, COUNT(*) FROM collection_name GROUP BY field_name 7. HAVING: Filter the GROUP BY query results. SELECT field_name, COUNT(*) FROM collection_name GROUP BY field_name HAVING COUNT(*) > 5 8. SORT: Sort the query results. SELECT field_name FROM collection_name SORT field_name DESC 9. Limit: Limit the number of query results. SELECT field_name FROM collection_name LIMIT 10 10. AGGREGATE: Use custom aggregation operations. LET min_value = (FOR doc IN collection_name COLLECT AGGREGATE min_value = MIN(doc.field_name) RETURN min_value) In the above example, collection_ Name represents the specific set name, field_ Name represents the specific field name. According to the actual situation, it can adapt to different table structures and sample data for querying.