Insert `tsv` files into postgresql db

csv, database, database-design, insert, postgresql

Solution

For tab separated values, you can use COPY:

http://www.postgresql.org/docs/current/static/sql-copy.html

Depending on the exact format of your file, it could be something like:

COPY ratings FROM 'C:/Users/testUser/Desktop/TSV/ratings.list.tsv' DELIMITER '\t'

Problem

I have several files which are saved as tsv. I want to insert them into a `postgresql` db, to analyze them with sql. However, my problem is how to `INSERT` this tsv files into `postgresql 9.2` under `windows 7`? I appreciate your reply! PS.: I have created the table with the right values like: `CREATE TABLE ratings (distribution VARCHAR, votes VARCHAR, rank FLOAT, title VARCHAR);` the file is in the directory: `C:/Users/testUser/Desktop/TSV/ratings.list.tsv`

Original source

Related problems