Import nhiều file vào nhiều bảng
mysqlimport cho phép truyền nhiều tên file cùng một lúc, mỗi file tương ứng với một bảng (tên file = tên bảng).
Ví dụ
Hai file dữ liệu:
student1_tbl.txt: 1 Saurav 11th 2 Sahil 11th 3 Digvijay 11th House.txt: 1 Furniture 2 Television 3 Refrigerator
Hai bảng đích:
mysql> DESCRIBE Student1_tbl; -- RollNo, Name, Class mysql> DESCRIBE House; -- Sr, Name
Lệnh import:
C:\mysql\bin> mysqlimport -u root query C:/mysql/bin/mysql-files/student_tbl.txt C:/mysql/bin/mysql-files/house.txt query.student_tbl: Records: 3 Deleted: 0 Skipped: 0 Warnings: 0 query.house: Records: 3 Deleted: 0 Skipped: 0 Warnings: 0
Kiểm tra:
mysql> SELECT * FROM House; +------+--------------+ | Sr | Name | +------+--------------+ | 1 | Furniture | | 2 | Television | | 3 | Refrigerator | +------+--------------+ mysql> SELECT * FROM student1_tbl; +--------+----------+-------+ | RollNo | Name | Class | +--------+----------+-------+ | 1 | Saurav | 11th | | 2 | Sahil | 11th | | 3 | Digvijay | 11th | +--------+----------+-------+