大家好,只是想问一下mysqldump。如何在没有值的现有 mysql 表中插入 csv 值?因为我的 .csv 文件包含两列。ID 和 NAME,我有一个有 3 列的表。一个是自动递增的 id,另一个是 brgy_name,最后是 brgy_code。在我的 csv 中,ID 列值应该放在 brgy_code 中,NAME 列值应该放在 brgy_name 中。
Example:
"id","name"
"1001","Bangued"
"1002","Boliney"
"1003","Bucay"
"1004","Bucloc"
"1005","Daguioman"
"1006","Danglas"
"1007","Dolores"
"1008","La Paz"
"1009","Lacub"
"1010","Lagangilang"
"1011","Lagayan"
"1012","Langiden"
"1013","Licuan-Baay"
"1014","Luba"
"1015","Malibcong"
"1016","Manabo"
"1017","Penarrubia"
"1018","Pidigan"
"1019","Pilar"
"1020","Sallapadan"
"1021","San Isidro"
"1022","San Juan"
"1023","San Quintin"
"1024","Tayum"
"1025","Tineg"
"1026","Tubo"
"1027","Villaviciosa"
"1028","Butuan City"
"1029","Buenavista"
"1030","Cabadbaran"
"1031","Carmen"
.
.
.
在我的表中,里面没有行。这是我的表结构:
CREATE TABLE `ref_barangay` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`brgy_name` VARCHAR(50) NOT NULL,
`brgy_code` VARCHAR(50) NOT NULL,
PRIMARY KEY (`id`)
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB;
我的问题是如何插入我的 csv 文件?在我的 csv 文件中,列 id 是 brgy_code。
Here's the what i want to do:
id brgy_name brgy_code
1 Bangued 1001
2 Boliney 1002
.
.
.
这就是所有的家伙我该怎么做?我想使用 mysql 转储,但我该怎么做?