csvsql --query 'SELECT dept, AVG(salary) FROM data GROUP BY dept' data.csv
Run SQL against a CSV, grouping by dept
csvsql turns any CSV into a queryable table named after the file, then runs the SQL you pass to --query against it. Here a GROUP BY dept with AVG(salary) reproduces a pivot-table summary in one line. The table name comes from the filename without its extension. This is the fastest way to apply SQL thinking to spreadsheet data.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.