add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE existing (phone VARCHAR(255))
SELECT '123456789' phone UNION ALL
SELECT '789456123' UNION ALL
SELECT '456456456' UNION ALL
SELECT '654654645' UNION ALL
SELECT '123321123' ;
SELECT * FROM existing;
phone
123456789
789456123
456456456
654654645
123321123
CREATE TABLE new (phone VARCHAR(255) UNIQUE)
SELECT '123456789' phone UNION ALL
SELECT '464646464' UNION ALL
SELECT '123321123' ;
SELECT * FROM new;
phone
123321123
123456789
464646464
INSERT
INTO existing (phone)
SELECT phone
FROM new
WHERE NOT EXISTS ( SELECT NULL
FROM existing
WHERE new.phone = existing.phone );
SELECT * FROM existing;
phone
123456789
789456123
456456456
654654645
123321123
464646464