Giorgi / PostgresSamples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Postgres Samples

Import CSV file by running

CREATE TABLE posts(id SERIAL PRIMARY KEY, title TEXT NOT NULL, body TEXT NOT NULL, author TEXT NOT NULL, tags TEXT NOT NULL);`
COPY posts(title, body, author, tags)
FROM 'C:\Users\Giorgi\Downloads\QueryResults.csv'
DELIMITER ','
CSV HEADER;
Update posts set tags = replace(tags, '><',' ')
Update posts set tags = replace(tags, '<', '')
Update posts set tags = replace(tags, '>', '')

CSV generated at https://data.stackexchange.com/stackoverflow by running

Select top 100000
Title, Body, OwnerDisplayName as Author, Tags
from posts
where posttypeid=1 and OwnerDisplayName is not null
and len(Body) < 10000
and body like '%full%'

About