How to import CSV file data into a PostgreSQL table?

前端 未结 19 2316
再見小時候
再見小時候 2020-11-22 02:14

How can I write a stored procedure that imports data from a CSV file and populates the table?

19条回答
  •  广开言路
    2020-11-22 03:17

    Use this SQL code

        copy table_name(atribute1,attribute2,attribute3...)
        from 'E:\test.csv' delimiter ',' csv header
    

    the header keyword lets the DBMS know that the csv file have a header with attributes

    for more visit http://www.postgresqltutorial.com/import-csv-file-into-posgresql-table/

提交回复
热议问题