I would like to import data from a CSV file with column headers into a database. I can do this with the COPY statement, but only if I first manually create a table with a column for each column in the CSV file. Is there any way to automatically create this table based on the headers in the CSV file?
here below is the query for to load csv into mysql table t1 in which t1 is already created in database manually
load data local infile "C:\\EQA\\project\\input1.csv"
into table request_table
character set latin1
fields terminated by','
ENCLOSED BY '"'
lines terminated by'\r\n'
IGNORE 1 ROWS
but i am actually looking to generate table based on csv headers is that possible? here my requirement is evertime when i export some data from other database like oracle i a able to store it into csv now i need to import this csv into other database like mysql if it is for one time we can do manually to create table in mysql what if i get many csv files from oracle databse? if i follow manually creating table it leads more complexity right!is ther any better case available if so can u please help me