snippets/old_snippets/temp-sqlite-table.en.md

21 lines
701 B
Markdown

---
title: "creating a temporary tabel in sqlite"
date: 2021-09-21T10:33:46+02:00
draft: false
snippet_types:
- sqlite
- sql
---
Today I needed to export some data from an sqlite tabel to csv, as part of my poverty line project.
Using [sqlitebrowser](https://sqlitebrowser.org/) I could see the table had to much data and I only wanted
to export a few columns. To accomplish this I learned how to create a temporary table and exported that.
```sql
DROP TABLE IF EXISTS processing_data_export;
CREATE TEMPORARY TABLE processing_data_export AS
SELECT x,y, county_id FROM grid;
```
source: [stackoverflow](https://stackoverflow.com/questions/26491230/sqlite-query-results-into-a-temp-table)