Search
 
SCRIPT & CODE EXAMPLE
 

SQL

postgres select as csv

-- To stdout
COPY (select * from table) TO STDOUT WITH CSV HEADER;

-- To file
COPY (select * from table) TO '/table.csv' WITH CSV HEADER;
Comment

Import CSV to PostgreSQL

COPY mytable FROM '/path/to/csv/file' WITH CSV HEADER; -- must be superuser
Comment

PREVIOUS NEXT
Code Example
Sql :: add column postgres with default value 
Sql :: sql check duplicate value in column 
Sql :: spring data.sql table not found 
Sql :: how to select one row in mysql 
Sql :: postgres set null 
Sql :: how to change the auto increment in existing table mysql 
Sql :: print hello world in plsql 
Sql :: t-sql create trigger 
Sql :: Get first 10 in sql 
Sql :: psql select database 
Sql :: mysql cast null to string 
Sql :: mssql check if date is greater than today 
Sql :: empty table sqlite 
Sql :: json extract 
Sql :: test the postgresql db connection 
Sql :: create delete procedure mysql 
Sql :: import sql in postgresql 
Sql :: alter column set not null to null postgres 
Sql :: inner join distinct 
Sql :: sql server previous month 
Sql :: mysql query with sql to get the next row 
Sql :: error code 1215 cannot add foreign key constraint 
Sql :: restart serial number for postgres 
Sql :: sql period overlap 
Sql :: q operator in plsql 
Sql :: unique key in ms sql server 
Sql :: mysql not defined 
Sql :: alter or change postgresql sequence counter 
Sql :: update table mysql 
Sql :: sqlite show table structure 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =