How to import .xls file to .sql with a foreign key

Viewed 3520

I have a excel spreadsheet:

id name  region  zone  
1  pokin Polon   Riny
2  lucy  yerni   kinta
...

And i have tables in mysql database which has region_id and zone_id instead which are foreign key to id in region and zone instead.

users table:

id name region_id zone_id
1  retre  1        1
...

region table:

id region_name
1   Polon
...

and zone table

id zone_name
1   kinta
...

I need to import the excel spreadsheet to users table.

6 Answers
Related