Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Export Postgres table to CSV

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 592
    Comment on it

    Postgres

    PostgreSQL is a powerful, open source object-relational database system. It supports storage of binary large objects, including pictures, sounds, or video. It compatible with may of programming interfaces like PHP, C/C++, Java, .Net, Perl, Python, Ruby, Tcl, ODBC, among others, and exceptional documentation. Postgres is better then Mysql when using many subqueries and Joins.

    For newbie: PostgreSQL installation and settings on Ubuntu 12.04

    These are following steps for exporting csv from table:

    sudo -u postgres psql DBNAME
    

    Note: Selecting DB is best way to specify which DB's tables you want to export.

    COPY tablename TO '/home/username/filename.csv' DELIMITER ',' CSV HEADER;
    

    Note: You need to specify table name and file name.

    Reference
    About PostgresSQL

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: