kettle -小技巧 null 跳过唯一索引

技术:插入 / 更新 控件中,比较符记得选 = ~NULL 哦

CREATE TABLE `testest` (
`id` int NOT NULL AUTO_INCREMENT,
`update` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`ctime` datetime DEFAULT CURRENT_TIMESTAMP,
`name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
code int ,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci COMMENT='在栽';

ALTER TABLE `GINA_TEST`.`testest`
ADD UNIQUE INDEX `testest_UNIQUE` (`name`,`code`)

insert into testest(name,code)values('gaokexin',123)

insert into testest(name,code)values(null,123)

insert into testest(name,code)values(null,123)

select * from testest

原文地址:https://www.cnblogs.com/gina11/p/15173379.html