3

I have a csv file with 19 columns. How can I import the file to PostgreSQL without first creating a table and writing every column down? Thanks!

4
  • 1
    You can't. A table needs to exist with the correct columns before you can import the CSV. Commented Jan 28, 2022 at 20:42
  • you can do it using csvsql, it will create the table and import data, take a look at : stackoverflow.com/questions/21018256/… Commented Jan 28, 2022 at 20:55
  • How people handle .csv file with 30+ or even more columns then. I know this can be done in Bigquery but I cannot save and download queries as a sql file. How about MySQL? Commented Jan 28, 2022 at 20:59
  • A SQL database is table based and you need one to exist to import data into. Now there are tools that will help you with this, but in the end they do the same thing create a table then import the data. Commented Jan 28, 2022 at 21:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.