Product:
DuckDB v1.5.5 (Variegata)
Issue:
How sum a big csv file? Excel is to small.
Solution:
Download DUCKDB, that is an embedded column-oriented database purpose-built for analytical workloads (OLAP).
DuckDB load your data in memory on your laptop, and then let you use SQL querys to find out information.
DuckDB’s SQL parser is derived from the pg_query library (https://www.sqlite.org/cli.html) , which is itself derived from PostgreSQL’s SQL parser that has been stripped down as much as possible.
On windows download the duckdb zip file, and unzip it to a folder like c:\duckdb. Go to that folder with powershell and enter DUCKDB to start the program. https://duckdb.org/install/?platform=windows&environment=cli
.\duckdb.exe
To import a csv file, that use European characters (note it use Linux syntax, forward slash for folders) , use a command like this:
create table budget as select * from read_csv_auto('c:/temp/db/datatabell.csv' , encoding='Latin-1') ;
This will create a in-memory databas called budget, that you can query, like to list number of rows:
select count(*) from budget ;

To get a sum for a month (note that it differs for small and capital letters Month and month are two different columns):
select sum(amount) from budget where Månad='01' and År=2027;
Enter below to get a quick glance of what column names exist in the database table:
select * from budget ;
Then you can see the name and if it is int64 or varchar. To find rows with zero as value, enter:
select * from budget where amount = 0;
To stop duckdb enter .exit. When you exit duckdb the database is erased.
More Information:
DuckDB’s architecture delivers several distinct advantages over traditional databases and data analysis tools:
- Vectorized query execution — Processes data in batches of 2048 rows, maximizing CPU cache efficiency and enabling SIMD acceleration
- Columnar storage — Only reads the columns your query requests, dramatically reducing I/O compared to row-based systems
- Direct file querying — Query CSV, Parquet, and JSON files directly without importing them first — a massive productivity boost
- Hybrid execution — Supports both in-memory and on-disk processing, automatically spilling to disk when datasets exceed available RAM
- Full SQL standard compliance — Supports complex queries including window functions, CTEs, PIVOT, and UNION that go far beyond what Excel or Pandas can do
- Multi-language support — First-class bindings for Python, R, Java, Node.js, C++, Rust, and many more
- Extension ecosystem — Load extensions for HTTP/S3 access, full-text search, spatial data, and more
How DuckDB Compares to Alternatives
| Aspect | DuckDB | SQLite | Pandas | PostgreSQL |
|---|---|---|---|---|
| Storage model | Columnar | Row-based | In-memory | Row-based |
| Analytics perf | ⚡ Fast | Slow | Fast (fits RAM) | Moderate |
| Setup time | Seconds | Seconds | Minutes (env) | Hours (server) |
| Max dataset | >RAM (spills) | <RAM | <RAM | >RAM |
| SQL features | Full | Basic | No native SQL | Full |
https://duckdblab.org/en/post/duckdb-beginners-guide-2026/
https://duckdb.org/docs/lts/data/csv/overview
https://duckdb.org/docs/current/guides/file_formats/csv_import
https://duckdb.org/docs/current/sql/introduction
https://motherduck.com/blog/duckdb-tutorial-for-beginners/
https://www.sqlite.org/cli.html
https://en.wikipedia.org/wiki/DuckDB
https://github.com/davidgasquez/awesome-duckdb
https://duckdblab.org/en/cheatsheet/
https://duckdb.org/docs/current/sql/dialect/friendly_sql
- Creating tables and inserting data:
CREATE OR REPLACE TABLE: avoidDROP TABLE IF EXISTSstatements in scripts.CREATE TABLE ... AS SELECT(CTAS): create a new table from the output of a table without manually defining a schema.INSERT INTO ... BY NAME: this variant of theINSERTstatement allows using column names instead of positions.INSERT OR IGNORE INTO ...: insert the rows that do not result in a conflict due toUNIQUEorPRIMARY KEYconstraints.INSERT OR REPLACE INTO ...: insert the rows that do not result in a conflict due toUNIQUEorPRIMARY KEYconstraints. For those that result in a conflict, replace the columns of the existing row to the new values of the to-be-inserted row.
- Describing tables and computing statistics:
- Making SQL clauses more compact and readable:
FROM-first syntax with an optionalSELECTclause: DuckDB allows queries in the form ofFROM tblwhich selects all columns (performing aSELECT *statement).GROUP BY ALL: omit the group-by columns by inferring them from the list of attributes in theSELECTclause.ORDER BY ALL: shorthand to order on all columns (e.g., to ensure deterministic results).SELECT * EXCLUDE: theEXCLUDEoption allows excluding specific columns from the*expression.SELECT * REPLACE: theREPLACEoption allows replacing specific columns with different expressions in a*expression.UNION BY NAME: perform theUNIONoperation along the names of columns (instead of relying on positions).- Prefix aliases in the
SELECTandFROMclauses: writex: 42instead of42 AS xfor improved readability. - Specifying a percentage of the table size for the
LIMITclause: writeLIMIT 10%to return 10% of the query results.
- Transforming tables:
- Defining SQL-level variables:
Query Features
- Column aliases in
WHERE,GROUP BY, andHAVING. (Note that column aliases cannot be used in theONclause ofJOINclauses.) COLUMNS()expression can be used to execute the same expression on multiple columns:- Reusable column aliases (also known as “lateral column aliases”), e.g.:
SELECT i + 1 AS j, j + 2 AS k FROM range(0, 3) t(i) - Advanced aggregation features for analytical (OLAP) queries:
count()shorthand forcount(*)INoperator for lists and maps- Specifying column names for common table expressions (
WITH) - Specifying column names in the
JOINclause - Using
VALUESin theJOINclause - Using
VALUESin the anchor part of common table expressions SWITCHstatements as syntactic sugar for theCASEexpression