Can I import delimited delimiter files into MySQL without creating database tables?

As the title says: I have a bunch of tab delimited text files containing data.

I know that if I use the CREATE TABLE statements to manually configure all the tables, I can then import them into the wait tables using "load data" or "mysqlimport".

But is there any way in MySQL to create tables automatically based on tab files? It seems like it should be. (I know that MySQL can guess the data type of each column, but you can specify this in the first line of the tab files.)

+4
source share
2 answers

No no. First you need CREATE a TABLE .

Automatic creation of tables and types of guessing fields is not part of the DBMS job. This is the task that is best left to an external tool or application (then the necessary CREATE statements are created).

+2
source

If you want to enter data types in the first line, why not enter the correct CREATE TABLE statement.

Then you can export the excel data as a txt file and use

 LOAD DATA INFILE 'path/file.txt' INTO TABLE your_table; 
0
source

Source: https://habr.com/ru/post/1300056/


All Articles