I am building an expert system with naive bayes method. I have a few table : rule, choice and diagnosis Rule:
-----------------------------------
|id|id_rule|id_diagnosis|id_choice|
-----------------------------------
|1 | 1| 1| 1|
|2 | 1| 2| 3|
|3 | 1| 3| 5|
|4 | 1| 4| 7|
|5 | 2| 1| 2|
|6 | 2| 2| 4|
|7 | 2| 3| 6|
|8 | 2| 4| 7|
-----------------------------------
Diagnosis
------------------------
|id_diagnosis|diagnosis|
------------------------
| 1| AAA|
| 2| BBB|
| 3| CCC|
| 4| DDD|
------------------------
Choice
-------------------------------
|id_choice|id_diagnosis|choice|
-------------------------------
| 1| 1| aa|
| 2| 1| bb|
| 3| 2| cc|
| 4| 2| dd|
| 5| 3| ee|
| 6| 3| ff|
| 7| 4| gg|
| 8| 4| hh|
-------------------------------
Within user interface, I can manually input the parameter (add rule) using select option form. With the name of option is id_choice and id_diagnosis. But I have many data that I need to calculate to this system. I have the data in csv format, the same format as the output of rule list ini my system like this:
----------------------
|rule|AAA|BBB|CCC|DDD|
----------------------
|1 |aa |cc |ee |gg |
|2 |bb |dd |ff |gg |
----------------------
But the problem is, I don't know how to add the data from csv format to database since in the table rule it only record the id, not the name of choice and diagnosis itself. I know that we can convert csv to multidimensional arrat, but I still confuse how to convert from name to id without doing it manually. Thanks
here is command:
LOAD DATA INFILE 'c:/country.csv'
INTO TABLE *table_name*
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS
Keep one thing in mind, never appear , in second column, otherwise your import will stop
Selamat malam.
You must import these data from one by one table which include a Primary key, then import data from tables which include a Foreign key
Except you want a backup/restore database, you must import all table of database.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.