# q - CSV 파일에 SQL쿼리 하기

> Clean Markdown view of GeekNews topic #3000. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=3000](https://news.hada.io/topic?id=3000)
- GeekNews Markdown: [https://news.hada.io/topic/3000.md](https://news.hada.io/topic/3000.md)
- Type: news
- Author: [xguru](https://news.hada.io/@xguru)
- Published: 2020-10-10T09:34:19+09:00
- Updated: 2020-10-10T09:34:19+09:00
- Original source: [harelba.github.io](https://harelba.github.io/q/)
- Points: 10
- Comments: 0

## Topic Body

"Text as Data"

- CSV/TSV 및 모든 Tabular Text 에서 쿼리 가능

- WHERE, GROUP BY, JOIN 등 대부분의 SQL구문 지원 (sqlite3)

- 자동 컬럼 이름 (c1,c2등) 및 컬럼 타입 디텍션 지원

- 예

ㅤq "SELECT COUNT(*) FROM ./clicks_file.csv WHERE c3 > 32.3"

ㅤps -ef | q -H "SELECT UID,COUNT(*) cnt FROM - GROUP BY UID ORDER BY cnt DESC LIMIT 3"

ㅤsudo find /tmp -ls | q "SELECT c5,c6,sum(c7)/1024.0/1024 AS total FROM - GROUP BY c5,c6 ORDER BY total desc"

- 한글을 포함한 모든 문자 인코딩 지원

## Comments



_No public comments on this page._
