我正在尝试恢复从SQL文件中丢失的一些数据。我想知道是否可以在所有数据或某些部分周围插入IF NOT EXIST?例如,我有超过500行:
INSERT INTO `TOWNY_RESIDENTS` (`name`, `town`, `lastOnline`, `registered`, `isNPC`, `title`, `surname`, `protectionStatus`, `friends`, `townBlocks`, `town-ranks`, `nation-ranks`)
VALUES
('003497', '', 1345023973086, 1344596322606, 0, '', '', 'residentBuild,residentDestroy,residentSwitch,residentItemUse', '', '', NULL, NULL),
('007belg', '', 1359561715886, 1359561236484, 0, '', '', 'residentBuild,residentDestroy,residentSwitch,residentItemUse', '', '', '', ''),
('00Landmine', '', 1360592736927, 1360592672899, 0, '', '', 'residentBuild,residentDestroy,residentSwitch,residentItemUse', '', '', '', '')
答案 0 :(得分:0)
您是否尝试过忽略?
INSERT IGNORE INTO `TOWNY_RESIDENTS`
(`name`, `town`, `lastOnline`, `registered`, `isNPC`, `title`, `surname`, `protectionStatus`, `friends`, `townBlocks`, `town-ranks`, `nation-ranks`)
VALUES ('003497', '', 1345023973086, 1344596322606, 0, '', '', 'residentBuild,residentDestroy,residentSwitch,residentItemUse', '', '', NULL, NULL)