csvsql --query 'SELECT dept, MAX(salary) AS top FROM data GROUP BY dept' data.csv
Find the top salary per dept with SQL
This csvsql query returns the maximum salary per department, aliased to top with AS. Any SQL that SQLite supports works inside --query, including joins, subqueries, and window functions. Writing the analysis in SQL often beats chaining awk one-liners. Add a WHERE clause to restrict rows before grouping.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.