About GROUP BY on a CSV
This page opens with a GROUP BY query on the sample customers table: how many customers are there in each country, most first. GROUP BY collapses rows that share a value and lets you count, sum or average the rest. It is free, needs no sign-up and runs in your browser, so nothing you enter is uploaded.
On the sample it returns UK 2, US 2, AT 1, FI 1. Add a HAVING clause to keep only groups above a count, or group by two columns for a cross-tab. For a point-and-click version, the pivot table maker does the same kind of summary.
How to use GROUP BY on a CSV
- Look at the Tables list to see the sample tables and their columns, or add your own CSV, TSV, XLSX, XLS or ODS files.
- Write a query in the SQL box, using the table and column names shown in the list.
- Press Run, or use Ctrl or Cmd with Enter.
- Read the result table below, move between pages if there are many rows, and download it as CSV.
- Remove a table with the cross, or add more files to join them.
Features
- SQLite running as WebAssembly in a Web Worker, served from this site.
- Several tables at once, so you can join files.
- CSV, TSV, XLSX, XLS and ODS input, one table per file or sheet.
- Column types detected from the data, blank cells stored as NULL.
- Results with paging, and an export of the full result as CSV.
- A time limit on queries, so a runaway query is stopped and your tables are reloaded.
- Clear SQL error messages from the engine.
Worked examples
SELECT country, COUNT(*) FROM customers GROUP BY country gives UK 2, US 2, AT 1, FI 1
Six customers in four countries.
Privacy: how it works
- Files are read in this browser tab and loaded into an in-memory database that disappears when you close the page. Nothing is uploaded, and the SQL engine file comes from this site, not from a CDN.
Tips
- Table and column names are cleaned to letters, digits and underscores, so "First Name" becomes First_Name.
- Use LIMIT while you are exploring a big table.
- Quote text with single quotes: WHERE country = 'UK'. Double quotes are for names.
- To check a join, count rows before and after. A join on a column with duplicates can multiply rows.
Frequently asked questions
Is it really free?
Yes. There is no price, no trial and no credit card. Ulkaa Tool does the work with your own device, so there is no server bill to pass on to you.
Do I need an account?
No. There is no sign-up and no login. Open the page and use it. An Ulkaa account is not needed for anything on this tool.
Does it run in my browser?
Yes. Your files and queries are processed by code running in your browser tab, on your own device.
Is my data uploaded?
No. Your files and queries are never sent to Ulkaa or to anyone else. You can check this yourself by watching the Network tab in your browser developer tools while you use the tool.
What is the difference between WHERE and HAVING?
WHERE filters rows before they are grouped. HAVING filters the groups after, so it can use COUNT or SUM.
More Run SQL on CSV pages
- Run SQL on CSVLoad CSV or Excel files as tables, write SQL and see the results.
- Join CSV Files With SQLCombine two files on a shared column, such as an id.
- Filter a CSV With SQLKeep only the rows that meet your conditions.
- Sort a CSV With SQLOrder rows by any column and keep the top few.
- Unique Values in a CSVList each value of a column once.